
[postgres@localhost pg_rman]$ pg_rman backup --backup-mode=full --backup-path=/data/pg_rman
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@localhost pg_rman]$
[postgres@localhost pg_rman]$
[postgres@localhost pg_rman]$ pg_rman validate --backup-path=/data/pg_rman
INFO: validate: "2022-04-06 14:30:12" backup and archive log files by CRC
INFO: backup "2022-04-06 14:30:12" is valid
[postgres@localhost pg_rman]$
[postgres@localhost pg_rman]$
[postgres@localhost pg_rman]$ pg_rman show --backup-path=/data/pg_rman
=====================================================================
StartTime EndTime Mode Size TLI Status
=====================================================================
2022-04-06 14:30:12 2022-04-06 14:30:14 FULL 386MB 1 OK
[postgres@localhost pg_rman]$
[postgres@localhost pg_rman]$
[postgres@localhost pg_rman]$ cd /data/postgres/14.2/bin
[postgres@localhost bin]$
[postgres@localhost bin]$
[postgres@localhost bin]$ pg_ctl stop -m fast
waiting for server to shut down.... done
server stopped
[postgres@localhost bin]$
[postgres@localhost bin]$
[postgres@localhost bin]$ rm -rf /data/postgres/14.2/data/*
[postgres@localhost bin]$
[postgres@localhost bin]$
[postgres@localhost bin]$ pg_rman restore --backup-path=/data/pg_rman
WARNING: pg_controldata file "/data/postgres/14.2/data/global/pg_control" does not exist
INFO: the recovery target timeline ID is not given
INFO: use timeline ID of latest full backup as recovery target: 1
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-04-06 14:30:12"
INFO: copying online WAL files and server log files
INFO: clearing restore destination
INFO: validate: "2022-04-06 14:30:12" backup and archive log files by SIZE
INFO: backup "2022-04-06 14:30:12" is valid
INFO: restoring database files from the full mode backup "2022-04-06 14:30:12"
INFO: searching incremental backup to be restored
INFO: searching backup which contained archived WAL files to be restored
INFO: backup "2022-04-06 14:30:12" is valid
INFO: restoring WAL files from backup "2022-04-06 14:30:12"
INFO: restoring online WAL files and server log files
INFO: create pg_rman_recovery.conf for recovery-related parameters.
INFO: remove an 'include' directive added by pg_rman in postgresql.conf if exists
INFO: append an 'include' directive in postgresql.conf for pg_rman_recovery.conf
INFO: generating recovery.signal
INFO: removing standby.signal if exists to restore as primary
INFO: restore complete
HINT: Recovery will start automatically when the PostgreSQL server is started. After the recovery is done, we recommend to remove recovery-related parameters configured by pg_rman.
[postgres@localhost bin]$
[postgres@localhost bin]$
[postgres@localhost bin]$
[postgres@localhost bin]$
[postgres@localhost bin]$ pg_ctl start
waiting for server to start....2022-04-06 14:32:21.796 CST [28159] LOG: starting PostgreSQL 14.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit
2022-04-06 14:32:21.796 CST [28159] LOG: listening on IPv4 address "0.0.0.0", port 5432
2022-04-06 14:32:21.796 CST [28159] LOG: listening on IPv6 address "::", port 5432
2022-04-06 14:32:21.797 CST [28159] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
2022-04-06 14:32:21.800 CST [28160] LOG: database system was interrupted; last known up at 2022-04-06 14:30:12 CST
2022-04-06 14:32:21.834 CST [28160] LOG: starting archive recovery
cp: cannot stat ‘/data/postgres/14.2/arch/00000001000000000000002D’: No such file or directory
2022-04-06 14:32:21.836 CST [28160] LOG: invalid checkpoint record
2022-04-06 14:32:21.836 CST [28160] FATAL: could not locate required checkpoint record
2022-04-06 14:32:21.836 CST [28160] HINT: If you are restoring from a backup, touch "/data/postgres/14.2/data/recovery.signal" and add required recovery options.
If you are not restoring from a backup, try removing the file "/data/postgres/14.2/data/backup_label".
Be careful: removing "/data/postgres/14.2/data/backup_label" will result in a corrupt cluster if restoring from a backup.
2022-04-06 14:32:21.837 CST [28159] LOG: startup process (PID 28160) exited with exit code 1
2022-04-06 14:32:21.837 CST [28159] LOG: aborting startup due to startup process failure
2022-04-06 14:32:21.838 CST [28159] LOG: database system is shut down
stopped waiting
pg_ctl: could not start server
Examine the log output.