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

來源:互聯網
上載者:User

標籤:not work   his   html   man   res   lease   dump   span   mac   

pg_dump and pg_restore 來備份和恢複資料庫中的資料。

原文:  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.

# Please note: The below commands worked for me. It may or may not work for you.

# Please use 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 have assumed that 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 by pg_dump and pg_restore, please visit http://www.postgresql.org/docs/9.0/static/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?

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.