总结:PgSql备份pg_dump与还原pg_restore

时间:2021-08-19 02:53:21

备份还原方法:pg_dump和pg_restore,先仔细说明这两个命令,再记录我的操作方法。

 

远程复制scp:

  #which scp 

  /usr/bin/scp

  #rpm -qf /usr/bin/scp

  /openssh-client.xxxx

  # ssh -p 端口  zhoz@zhoz.com

  # scp -v -P 端口  /home/zhoz/db_zhoz_081121.tar zhoz@zhoz.com:/home/zhoz/

数据备份pg_dump与还原pg_restore:

  备份:pg_dump -h localhost -p 5432 -U tradesns -W -F c -b -v -f "/home/tradeworkwangbin/us2010.backup" us2010

  恢复:pg_restore -h 192.168.0.100 -p 5432 -U postgres -W -d us2011 -v "/root/us2010.backup"

 

 参照资料:

   http://www.cnblogs.com/chjbbs/p/6480642.html?utm_source=itdadao&utm_medium=referral

   http://www.cnblogs.com/starof/p/4709805.html