postgresql 备份恢复(一)

本文探讨了数据库备份的重要性,尤其是冷备份在确保数据完整性的角色。对于PostgreSQL,虽然冷备份可能影响系统可用性,但仍然有价值。文章介绍了两种常见的冷备份方式:操作系统命令和数据库工具(如pg_dump)。通过使用pg_dump,作者测试了数据库、表和SCHEMA的备份,并指出在恢复和备份SCHEMA时遇到的问题。
摘要由CSDN通过智能技术生成

备 份恢复对于每个数据来说都是非常重要的。一般的数据库都支持冷备份的方式,冷备份可以保证数据库在此刻的完整性。但是其缺点也非常的明显,为保持数据一致 性。冷备份期间数据库中相关数据是不能够使用的,就大大影响的系统的可用性。不管怎样冷备份在很多的情况下还是很有用的。

数据库的冷备份一般支持两种方式:

1,操作系统级别的命令备份(cp,copy)

2,数据库工具备份(pg_dump)

针对postgresql数据库的pg_dump工具进行了一下测试(还碰到一个小问题)。

pg_dump工具命令与参数的参考:

 

代码
   
   
   
pg_dump dumps a database as a text file or to other formats.

Usage:
pg_dump [OPTION]... [DBNAME]

General options:
-f, --file=FILENAME output file name
-F, --format=c|t|p output file format (custom, tar, plain text)
-i, --ignore-version proceed even when server version mismatches
pg_dump version
-v, --verbose verbose mode
-Z, --compress=0-9 compression level for compressed formats
--help show this help, then exit
--version output version information, then exit

Options controlling the output content:
-a, --data-only dump only the data, not the schema
-b, --blobs include large objects in dump
-c, --clean clean (drop) schema prior to create
-C, --create include commands to create database in dump
-d, --inserts dump data as INSERT commands, rather than COPY
-D, --column-inserts dump data as INSERT commands with column names
-E, --encoding=ENCODING dump the data in encoding ENCODING
-n, --schema=SCHEMA dump the named schema(s) only
-N, --exclude-schema=SCHEMA do NOT dump the named schema(s)
-o, --oids include OIDs in dump
-O, --no-owner skip restoration of object ownership
in plain text format
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值