How to backup a remote PostgreSQL db and restore it locally?

Source: Internet
Author: User
Tags postgresql

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?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.