
[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
请问如何排查这个问题?