当前位置: 移动技术网 > IT编程>数据库>MSSQL > postgresql数据库备份与恢复

postgresql数据库备份与恢复

2018年04月19日  | 移动技术网IT编程  | 我要评论

辽宁卫视高清直播,广州医科大学首页,今日柴油价格查询

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

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网