码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2018-06-28 14:43:35      阅读:200      评论:0      收藏:0      [点我收藏+]

标签: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?

标签:not work   his   html   man   res   lease   dump   span   mac   

原文地址:https://www.cnblogs.com/oxspirt/p/9238455.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!