Pg_dump and Pg_restore to back up and restore data from the database.
Original: https://ksearch.wordpress.com/2012/09/28/how-to-backup-a-remote-postgresql-db-and-restore-it-locally/
--------------------------------------
This article lists the commands to dump a remote PostgreSQL database in a local file and then restore it on the localhost PostgreSQL server running.
# note:the below commands worked for me. It may or may not be work for you.
# Use the IT at your own risk. # Create A database dump of the the remote DB. Pg_dump-h-fc-o-u remote-postgresql-user remote-db-name > mydatabase.dump # example:pg_dump-h 10.20.30.40-FC -o-u postgres mydatabase > mydatabase.dump # Restore The db dump as a local PostgreSQL database. # Note that I hav E assumed you have already installed and configured PostgreSQL
# in your local machine. Sudo-u postgres pg_restore-c mydatabase.dump
For a details of the command line options supported pg_dump
pg_restore
by and, please visit http://www.postgresql.org/docs/9.0/st Atic/app-pgdump.html and http://www.postgresql.org/docs/9.0/static/app-pgrestore.html respectively.
How to backup a remote PostgreSQL db and restore it locally?