postgresql物理备份pg_rman使用总结

博客介绍了PostgreSQL相关操作,包括使用yum和wget安装相关库和工具,创建备份目录并设置权限,初始化备份环境。还详细说明了全量和增量压缩备份、查看备份、备份校验以及还原备份的具体命令,如pg_rman backup、pg_rman show等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

yum -y install libpq.so
wget https://yum.postgresql.org/9.5/redhat/rhel-7.2-x86_64/postgresql95-libs-9.5.15-1PGDG.rhel7.x86_64.rpm
wget https://github.com/ossc-db/pg_rman/releases/download/V1.3.8/pg_rman-1.3.8-1.pg95.rhel7.x86_64.rpm
rpm -ivh postgresql95-libs-9.5.15-1PGDG.rhel7.x86_64.rpm
rpm -ivh pg_rman-1.3.8-1.pg95.rhel7.x86_64.rpm
mkdir /data/rman_backup
chown postgres:postgres /data/rman_backup
su - postgres
vi .bash_profile

export PGDATA=/data/postgres/data
export PATH=/usr/local/pgsql/bin
export LD_LIBRARY_PATH=/usr/local/pgsql/lib
export BACKUP_PATH=/data/rman_backup
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$PG_PATH

source .bash_profile
pg_rman init -B /data/rman_backup/
全量压缩备份
pg_rman backup -b full -d sde -Z
增量压缩备份
pg_rman backup -b incremental -d sde -Z
查看备份
pg_rman show
备份校验(每次备份完,必须要做一次校验,否则备份集不可用用来恢复,增量备份时也不会用它来做增量比较)
pg_rman validate
还原备份
pg_rman restore --recovery-target-time “2019-07-11 13:48:00”;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值