PG_Dump PG_Restore
Dump a remote postgres database and restore it into a local postgres database. This method dumps first into a local file, then restores into the database. The reason for doing it this way over piping the data straight into the database locally is that if there is an error in the import you don’t have to start over again. Which is likely to happen if you haven’t created the database first.
/usr/bin/pg_dump -h remote.server.com -p 5432 -U postgres_user -i -F c -b -v -f “/tmp/db_name.backup” db_name
/usr/bin/pg_restore -U postgres_user-W -F c -v -c -O -d db_name “/tmp/db_name.backup”
/usr/bin/pg_restore -U postgres_user-W -F c -v -c -O -d db_name “/tmp/db_name.backup”
Related Posts
Posted on September 25, 2009 at 10:21 am by Jordan Carter · Permalink
In: Server Config, Web Development · Tagged with: database, pg_dump, pg_restore, postgresql, psql, remote server
In: Server Config, Web Development · Tagged with: database, pg_dump, pg_restore, postgresql, psql, remote server