随笔 - 404  文章 - 4  评论 - 0  阅读 - 25万

【PgSQL备份】物理备份pg_rman

数据库及pg_rman版本

postgresql:(PostgreSQL) 12.3

pg_rman:pg_rman-1.3.9-pg12.tar.gz

tar -zxvf pg_rman-1.3.9-pg12.tar.gz -C /usr/local/

su - postgres

cd /usr/local/pg_rman-1.3.9-pg12

make 

make install

 

编辑环境变量

$ id
uid=5432(postgres) gid=5432(postgres) groups=5432(postgres)
$ pwd
/home/postgres

$vi .bash_profile
export PATH=$PATH:$HOME/.local/bin:$HOME/bin:$PGHOME/bin

$ pg_rman init -B /data/db_backup
INFO: ARCLOG_PATH is set to '/data/pgsql_5432/archive/'
INFO: SRVLOG_PATH is set to '/data/pgsql_5432/logs/'
全量压缩备份
$ pg_rman backup -b full -U postgres -Z -h 127.0.0.1 -p 5432
Password for user postgres: 

INFO: copying database files
INFO: copying archived WAL files
INFO: backup complete
INFO: Please execute 'pg_rman validate' to verify the files are correctly copied.

增量压缩备份

pg_rman backup -b incremental -U postgres -Z -h 127.0.0.1 -p 5432

查看备份

pg_rman show

备份校验(每次备份完,必须要做一次校验,否则备份集不可用来恢复,增量备份时也不会用它来做增量比较)

pg_rman validate

还原备份

pg_rman restore --recovery-target-time “2020-06-11 23:00:00”;

 http://mysql.taobao.org/monthly/2016/09/05/

posted on   HelonTian  阅读(326)  评论(0编辑  收藏  举报
(评论功能已被禁用)
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
历史上的今天:
2018-06-20 MySQL的性能指标计算和优化方法
2018-06-20 mysqlbinlog读懂binlog
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示