postgresql 备份恢复(三) pg_rman

pg_rman是一款专门为postgresql设计的在线备份恢复的工具。其支持在线和基于时间点备份方式,还可以通过创建backup catalog来维护DB cluster备份信息。

[pg-rman]

看起来好像是模仿oracle的RMAN工具。

 pg_rman特点:

  • 使用简单.一个命令即可完成备份和恢复.
  •  支持在线全备,增量备份,归档备份.
  • 支持备份压缩.通过gzip工具实现页内压缩.
  • 自动备份维护.自动删除过期的WAL备份文件.
  • 支持备份验证.
  • 恢复期间无事务丢失.支持基于PITR的配置文件生成器.

pg_rman平台支持:

代码
Tested platforms:
OS Edition PostgreSQL Revision Date
Linux Fedora
11 8.4.2 23 2009-12-18
Linux Fedora
11 8.3.9 23 2009-12-18
Linux Fedora
11 8.2.15 23 2009-12-18

Requirements:

* Linux (and some of UNIXes)
* PostgreSQL 8,2, 8.3, 8.4, and 8.5

Unsupported platforms:

* Windows
* PostgreSQL 8.1 or prior versions.

 

pg_rman命令参考:

代码
[postgre@daduxiong etc]$ pg_rman --help
pg_rman manage backup
/recovery of PostgreSQL database.

Usage:
pg_rman OPTION init
pg_rman OPTION backup
pg_rman OPTION restore
pg_rman OPTION show [DATE]
pg_rman OPTION show timeline [DATE]
pg_rman OPTION validate [DATE]
pg_rman OPTION delete DATE

Common Options:
-D, --pgdata=PATH location of the database storage area
-A, --arclog-path=PATH location of archive WAL storage area
-S, --srvlog-path=PATH location of server log storage area
-B, --backup-path=PATH location of the backup storage area
-c, --check show what would have been done

Backup options:
-b, --backup-mode=MODE full, incremental, or archive
-s, --with-serverlog also backup server log files
-Z, --compress-data compress data backup with zlib
-C, --smooth-checkpoint do smooth checkpoint before backup
--keep-data-generations=N keep GENERATION of full data backup
--keep-data-days=DAY keep enough data backup to recover to DAY days age
--keep-arclog-files=NUM keep NUM of archived WAL
--keep-arclog-days=DAY keep archived WAL modified in DAY days
--keep-srvlog-files=NUM keep NUM of serverlogs
--keep-srvlog-days=DAY keep serverlog modified in DAY days

Restore options:
--recovery-target-time time stamp up to which recovery will proceed
--recovery-target-xid transaction ID up to which recovery will proceed
--recovery-target-inclusive whether we stop just after the recovery target
--recovery-target-timeline recovering into a particular timeline

Catalog options:
-a, --show-all show deleted backup too

Connection options:
-d, --dbname=DBNAME database to connect
-h, --host=HOSTNAME database server host or socket directory
-p, --port=PORT database server port
-U, --username=USERNAME user name to connect as
-w, --no-password never prompt for password
-W, --password force password prompt

Generic options:
-q, --quiet don't write any messages
--debug debug mode
--help show this help, then exit
--version output version information, then exit

Read the website
for details. <http://code.google.com/p/pg-rman/>
Report bugs to <http://code.google.com/p/pg-rman/issues/list>.
pg_rman安装:

进入下载http://code.google.com/p/pg-rman/downloads/list

通过解压,然后编译即可使用。

过程非常简单。

posted on 2010-09-01 16:49  大肚熊  阅读(3329)  评论(0编辑  收藏  举报

导航