首页 > 数据库技术 > 详细

postgresql wal文件误删恢复

时间:2021-09-11 15:30:45      阅读:22      评论:0      收藏:0      [点我收藏+]
2021-09-10 17:22:42.417183T  @  startup  00000 [2021-09-10 17:22:42 CST] 0 [9298] LOCATION:  StartupXLOG, xlog.c:6347
2021-09-10 17:22:42.417206T  @  startup  XX000 [2021-09-10 17:22:42 CST] 0 [9298] FATAL:  XX000: required WAL directory "pg_wal" does not exist
2021-09-10 17:22:42.417206T  @  startup  XX000 [2021-09-10 17:22:42 CST] 0 [9298] LOCATION:  ValidateXLOGDirectoryStructure, xlog.c:4262
2021-09-10 17:22:42.417407T  @  postmaster  00000 [2021-09-10 17:22:42 CST] 0 [9296] LOG:  00000: startup process (PID 9298) exited with exit code 1
2021-09-10 17:22:42.417407T  @  postmaster  00000 [2021-09-10 17:22:42 CST] 0 [9296] LOCATION:  LogChildExit, postmaster.c:3714
2021-09-10 17:22:42.417417T  @  postmaster  00000 [2021-09-10 17:22:42 CST] 0 [9296] LOG:  00000: aborting startup due to startup process failure
2021-09-10 17:22:42.417417T  @  postmaster  00000 [2021-09-10 17:22:42 CST] 0 [9296] LOCATION:  reaper, postmaster.c:2969
2021-09-10 17:22:42.427171T  @  postmaster  00000 [2021-09-10 17:22:42 CST] 0 [9296] LOG:  00000: database system is shut down
2021-09-10 17:22:42.427171T  @  postmaster  00000 [2021-09-10 17:22:42 CST] 0 [9296] LOCATION:  UnlinkLockFiles, miscinit.c:928

执行pg_resetwal -f PGDATA可以wal文件,但是会丢失事务日志以及数据不一致,极端情况下某些数据块丢失。此时回初始化WAL文件如下:

[zjh@lightdb1 pgsql13.2]$ cd data/pg_wal/
[zjh@lightdb1 pg_wal]$ ll
total 1048576
-rw------- 1 zjh zjh 1073741824 Sep 10 21:44 00000001000000BB00000001
drwx------ 2 zjh zjh          6 Sep 10 21:42 archive_status

再启动PG,备份、重建。

postgresql wal文件误删恢复

原文:https://www.cnblogs.com/zhjh256/p/15253179.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!