暂无图片
pg_rman增量恢复出错了
我来答
分享
暂无图片 匿名用户
pg_rman增量恢复出错了

[postgres@test_dan ~]$ pg_rman show
=====================================================================
StartTime EndTime Mode Size TLI Status
=====================================================================
2022-03-03 09:52:54 2022-03-03 09:53:03 INCR 33MB 2 OK
2022-03-03 09:20:53 2022-03-03 09:24:18 FULL 2585MB 2 OK
[postgres@test_dan ~]$ pg_rman restore --backup-path=/backup/rman_backup --recovery-target-time='2022-03-03 09:53:03'
ERROR: PostgreSQL server is running
HINT: Please stop PostgreSQL server before executing restore.
[postgres@test_dan ~]$ pg_ctl stop
waiting for server to shut down.... done
server stopped
[postgres@test_dan ~]$
[postgres@test_dan ~]$ pg_rman restore --backup-path=/backup/rman_backup --recovery-target-time='2022-03-03 09:53:03'
INFO: the recovery target timeline ID is not given
INFO: use timeline ID of current database cluster as recovery target: 2
INFO: calculating timeline branches to be used to recovery target point
INFO: searching latest full backup which can be used as restore start point
INFO: found the full backup can be used as base in recovery: "2022-03-03 09:20:53"
INFO: copying online WAL files and server log files
INFO: clearing restore destination
INFO: validate: "2022-03-03 09:20:53" backup and archive log files by SIZE
INFO: backup "2022-03-03 09:20:53" is valid
INFO: restoring database files from the full mode backup "2022-03-03 09:20:53"
INFO: searching incremental backup to be restored
INFO: validate: "2022-03-03 09:52:54" backup and archive log files by SIZE
INFO: backup "2022-03-03 09:52:54" is valid
INFO: restoring database files from the incremental mode backup "2022-03-03 09:52:54"
INFO: searching backup which contained archived WAL files to be restored
INFO: backup "2022-03-03 09:52:54" is valid
INFO: restoring WAL files from backup "2022-03-03 09:52:54"
INFO: restoring online WAL files and server log files
INFO: generating recovery.conf
INFO: restore complete
HINT: Recovery will start automatically when the PostgreSQL server is started.


全备恢复没有问题,

增量恢复日志就出现问题了,恢复完后mydb1不能用


如下所示:


(postgres@[local]:5432)-[postgres]-#\l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
alvindb | alvin | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
bldemo | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
mydb | pguser | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =Tc/pguser +
| | | | | pguser=C*T*c*/pguser
mydb1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
postgres | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
template0 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
test | admin | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |
(8 rows)

(postgres@[local]:5432)-[postgres]-#\c mydb1
FATAL: database "mydb1" does not exist
DETAIL: The database subdirectory "base/32482" is missing.
Previous connection kept


请问如何排查这个问题?

我来答
添加附件
收藏
分享
问题补充
2条回答
默认
最新
杜京

你把备份恢复脚本贴出来吧 大家一起看看

暂无图片 评论
暂无图片 有用 0
nanjing_2013

第一次备份--全备

[postgres@test_dan rman_backup]$ pg_rman backup --backup-mode=full --backup-path=/backup/rman_backup
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.
[postgres@test_dan rman_backup]$ pwd

[postgres@test_dan rman_backup]$ ll
总用量 5
drwx------ 3 postgres postgres 1024 3月 3 09:20 20220303 ---第一次全备产生的
drwx------ 4 postgres postgres 1024 3月 3 09:16 backup
-rw-rw-r-- 1 postgres postgres 73 3月 3 09:16 pg_rman.ini
-rw-rw-r-- 1 postgres postgres 40 3月 3 09:16 system_identifier
drwx------ 2 postgres postgres 1024 3月 3 09:24 timeline_history ----第一次全备修改此目录
[postgres@test_dan rman_backup]$

[postgres@test_dan rman_backup]$ pg_rman show --backup-path=/backup/rman_backup ---列出备份集
=====================================================================
StartTime EndTime Mode Size TLI Status
=====================================================================
2022-03-03 09:20:53 2022-03-03 09:24:18 FULL 2585MB 2 OK


第2次增量备份


pg_rman backup --backup-mode=incremental --backup-path=/backup/rman_backup
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.

[postgres@test_dan rman_backup]$ pg_rman validate --backup-path=/backup/rman_backup/
INFO: validate: "2022-03-03 09:52:54" backup and archive log files by CRC
INFO: backup "2022-03-03 09:52:54" is valid


[postgres@test_dan rman_backup]$ pg_rman show --backup-path=/backup/rman_backup/
=====================================================================
StartTime EndTime Mode Size TLI Status
=====================================================================
2022-03-03 09:52:54 2022-03-03 09:53:03 INCR 33MB 2 OK
2022-03-03 09:20:53 2022-03-03 09:24:18 FULL 2585MB 2 OK



[postgres@test_dan rman_backup]$ pg_rman restore --backup-path=/backup/rman_backup --recovery-target-time='2022-03-03 09:24:18'  ---使用全备恢复没问题

再使用增量恢复就报错了

pg_rman restore --backup-path=/backup/rman_backup --recovery-target-time='2022-03-03 09:53:03' --增量备份结束的时间

我是本机备份的,本机恢复的

暂无图片 评论
暂无图片 有用 0
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏