虚位以待(AD)
虚位以待(AD)
首页 > 数据库 > MsSql数据库 > postgresql数据库备份与恢复

postgresql数据库备份与恢复
类别:MsSql数据库   作者:码皇   来源:<a href="http://blog.csdn.net/zhubaojay" target="_blank" rel="nofollow&q   点击:

postgresql数据库备份与恢复。

postgresql数据库备份与恢复

pg_dump
1. 备份整个数据库:pg_dump -U nsc -d nsc -C -F c -f nsc.sql
2. 备份一张表内容:pg_dump -U nsc -d nsc -a -F c -t mail_send -f mail_send.sql
3. 备份整个表结构:pg_dump -U nsc -d nsc -F c -s -f pg_struct.sql

-C 表示创建该数据库本身。

-F c 表示给pg_restore还原的格式格式,默认表示纯文本格式。

-f 指定输出文件名称。

-a 表示只备份表的内容。

-t 指定表名。

-s 表示只备份表结构。

上述对应恢复命令:
pg_restore
1. 恢复整个数据库:pg_restore -U postgres -d postgres -C -F c nsc.sql
2. 恢复一张表内容:pg_restore -U nsc -d nsc -F c -a mail_send.sql
3. 恢复整个表结构:pg_restore -U nsc -d nsc -F c -s pg_struct.sql
相关热词搜索: