3.9. Directly transferring a PostgreSQL database from one server to another
You can use the pg_dump and psql utilities to back up a PostgreSQL database and directly restore it on another PostgreSQL server. With this method you can transfer a database in a single step without intermediate files.
Prerequisites
-
You are logged in as the
postgresuser.
Procedure
Transfer a database from the source server to a destination server:
$ pg_dump -h <source_server> <db_name> | psql -h <destination_server> <db_name>