暂无图片
pg_rman备份恢复后启动数据库报错,下面是演示操作
我来答
分享
暂无图片 匿名用户
pg_rman备份恢复后启动数据库报错,下面是演示操作

[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.

我来答
添加附件
收藏
分享
问题补充
1条回答
默认
最新
彭冲

使用源码编译pg14.2+源码编译pg_rman 1.3.14在centos7.6未能复现问题。

恢复过程:

[postgres@pg ~]$ pg_rman restore \
> --pgdata=/opt/pgdatatest \
> --backup-path=/home/postgres/pgdata_pgrman
WARNING: pg_controldata file "/opt/pgdatatest/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 16:44:28"
INFO: copying online WAL files and server log files
INFO: clearing restore destination
INFO: validate: "2022-04-06 16:44:28" backup and archive log files by SIZE
INFO: backup "2022-04-06 16:44:28" is valid
INFO: restoring database files from the full mode backup "2022-04-06 16:44:28"
INFO: searching incremental backup to be restored
INFO: searching backup which contained archived WAL files to be restored
INFO: backup "2022-04-06 16:44:28" is valid
INFO: restoring WAL files from backup "2022-04-06 16:44:28"
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@pg ~]$ pg_ctl start -D /opt/pgdatatest/
waiting for server to start....2022-04-06 16:52:28.536 CST [9001] LOG:  Auto detecting pg_stat_kcache.linux_hz parameter...
2022-04-06 16:52:28.536 CST [9001] LOG:  pg_stat_kcache.linux_hz is set to 1000000
2022-04-06 16:52:28.550 CST [9001] LOG:  redirecting log output to logging collector process
2022-04-06 16:52:28.550 CST [9001] HINT:  Future log output will appear in directory "log".
.... done
server started
复制
暂无图片 评论
暂无图片 有用 0
打赏 0
回答交流
Markdown


请输入正文
提交
相关推荐
创建表提示没有权限
回答 1
升级问题到:紧急故障
有什么开源的跨云厂商的数据库同步工具比较好用?
回答 1
可以考虑这个方案,代码开源可以二次开发:kafkadebezium
这个如何改成pg中的存储过程??
回答 2
createorreplaceprocedureproc01nocommit()as$$declarec01cursorforselectidfromt1;vidinteger;beginopenc0
pg_class.relfrozenxid字段的含义,取值,更新问题?
回答 1
pgclass.relfrozenxid字段是PostgreSQL数据库中一个重要的字段,它用于记录表的冻结事务ID,并在VACUUMFREEZE操作中发挥关键作用。通过合理设置和使用该字段,可以维护
Postgres-XL集群方案在生产环境的应用情况
回答 2
pgxl方案的确是没怎么更新了,试试Greenplum或者citus方案,另外如果不追求cluster级别可以考虑下postgresfdw。
postgres有 falshback query?
回答 3
因为是人为误操作,所以常规操作手段是优先考虑物理恢复,即在异机环境做库恢复,然后读出误操作前的数据,再将数据导入到生产环境;当然也可以在生产库使用物理备份集和归档进行基于时间点恢复,全库恢复到误操作前
postgresql jsonb字段超过65536,会自动截断怎么处理?
回答 1
已采纳
分多个列保存,应用获取后进行拼接
怎么查看PostgreSQL收到了什么请求/sql语句?
回答 1
已采纳
selectdatname,pid,sessid,usename,clientaddr,querystart,queryfrompgstatactivity;希望对你有所帮助,如有帮助请采纳
patroni报错
回答 1
上传附件:messages
在PostgresSQL的数值类型中,不精确的数据类型有哪个?
回答 1
已采纳
ACD"real"数据类型是一种浮点数类型,它是不精确的,因为它使用二进制浮点表示法来存储数字。与之不同,"numeric"数据类型是精确的,它以文本形式存储数字,可以表示精确的小数值。"double