机房断电后重启pg数据库,报如下错误:
< 2019-01-01 22:42:59.240 EST >LOG: database system was interrupted while in recovery at 2019-01-01 22:00:58 EST < 2019-01-01 22:42:59.240 EST >HINT: This probably means that some data is corrupted and you will have to use the last backup for recovery. < 2019-01-01 22:42:59.241 EST >LOG: database system was not properly shut down; automatic recovery in progress < 2019-01-01 22:42:59.333 EST >PANIC: unexpected pageaddr 26EA/46000000 in log segment 00000001000026EA00000017, offset 0 < 2019-01-01 22:42:59.333 EST >LOG: startup process (PID 88586) was terminated by signal 6: Aborted < 2019-01-01 22:42:59.333 EST >LOG: aborting startup due to startup process failure
修复方法:
切换到bin目录下:
cd /usr/pgsql-9.3/bin
使用pg_resetxlog命令修复日志:(/var/lib/pgsql/9.3/data为pg_data的目录)
pg_resetxlog -f /var/lib/pgsql/9.3/data
重启数据库:
pg_ctl start
补充:PostgreSQL 数据库服务无法启动的解决方法
因为客户那边的磁盘一般是FAT32的文件系统,所以我们程序安装时,采用手动安装PostgreSQL的形式安装数据库,但初始化数据库群成功并且成功注册了系统服务后,
发现PostgreSQL的服务总是启动不了,提示服务启动又停止了,然后在系统时间查看器里发现报的错误是:Could not create inherited socket, 错误编码为10022
解决方法:
运行 netsh winsock reset,重启电脑,OK!
以上为个人经验,希望能给大家一个参考,也希望大家多多支持。如有错误或未考虑完全的地方,望不吝赐教。