gpt4 book ai didi

postgresql - 修复损坏的 postgresql 数据库

转载 作者:行者123 更新时间:2023-11-29 12:38:46 24 4
gpt4 key购买 nike

这是当 postgresql 在电源故障后尝试启动时发生的情况:

2012-01-27 18:00:44 MSK LOG:  database system was interrupted while in recovery at 2012-01-27 18:00:16 MSK
2012-01-27 18:00:44 MSK HINT: This probably means that some data is corrupted and you will have to use the last backup for recovery.
2012-01-27 18:00:44 MSK LOG: database system was not properly shut down; automatic recovery in progress
2012-01-27 18:00:44 MSK LOG: consistent recovery state reached at 17/762C39B8
2012-01-27 18:00:44 MSK LOG: redo starts at 17/761F6A40
2012-01-27 18:00:44 MSK FATAL: invalid page header in block 311757 of relation base/26976/27977
2012-01-27 18:00:44 MSK CONTEXT: xlog redo insert: rel 1663/26976/27977; tid 311757/44
2012-01-27 18:00:44 MSK LOG: startup process (PID 392) exited with exit code 1
2012-01-27 18:00:44 MSK LOG: aborting startup due to startup process failure

知道我不是运气不好,在这种情况下我可以使用一个命令来修复数据库。只要数据库变得一致,最后几个小时的事务是否消失并不重要。

请告诉我在这种情况下该怎么做。

最佳答案

我使用以下命令修复了它:

mkdir -p /var/run/postgresql/9.6-main.pg_stat_tmp

sudo service postgresql-9.6 restart

如错误消息所示更改文件名/版本。

关于postgresql - 修复损坏的 postgresql 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9034952/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com