机房断电后重启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!
以上为个人经验,希望能给大家一个参考,也希望大家多多支持www.887551.com。如有错误或未考虑完全的地方,望不吝赐教。