Quantcast
Channel: CodeSection,代码区,SQL Server(mssql)数据库 技术分享 - CodeSec
Viewing all articles
Browse latest Browse all 3160

postgresql数据库备份与恢复 sql SQLServer postgresql 数据库备份 数据库恢复

$
0
0
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

Viewing all articles
Browse latest Browse all 3160

Latest Images

Trending Articles



Latest Images