How to backup a remote PostgreSQL db and restore it locally?
Posted 牛顿的小脑
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了How to backup a remote PostgreSQL db and restore it locally?相关的知识,希望对你有一定的参考价值。
pg_dump and pg_restore 来备份和恢复数据库中的数据。
--------------------------------------
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?的主要内容,如果未能解决你的问题,请参考以下文章
How to provide username and password when run "git clone git@remote.git"? - Stack Overflow
How To Restore Rman Backups On A Different Node When The Directory Structures Are Different (Doc ID
gitlab自动备份脚本auto_backup_to_remote
sh 使用SCP在系统之间传输文件 - 来自http://unix.stackexchange.com/questions/188285/how-to-copy-a-file-from-a-remot