mysql 使用 Forcing InnoDB Recovery 恢复数据库

时间:2015-07-21 19:03:38   收藏:0   阅读:1685

环境:

CentOS release 6.6 (Final)

Server version: 5.5.42-37.1-log Percona Server (GPL), Release 37.1, Revision 39acee0


现象:

数据库挂掉,重启报错

The server quit without updating PID file (/var/lib/mysql/cm.data.dingkai.com.pid).[失败]

日志:

150721 12:38:37  InnoDB: Database was not shut down normally!

InnoDB: Starting crash recovery.

InnoDB: Reading tablespace information from the .ibd files...

InnoDB: Restoring possible half-written data pages from the doublewrite

InnoDB: buffer...

InnoDB: Doing recovery: scanned up to log sequence number 9044491443

150721 12:38:37  InnoDB: Error: page 7 log sequence number 17979997238

InnoDB: is in the future! Current system log sequence number 9044491443.

InnoDB: Your database may be corrupt or you may have copied the InnoDB


这说明库在重启启动后需要做恢复,但是数据库的log出现坏块。


解决:

使用Forcing InnoDB Recovery 启动库并备份数据,重新建库。


关于innodb_force_recovery 参数值的描述如下:

As a safety measure, InnoDB prevents INSERTUPDATE, or DELETE operations when innodb_force_recovery is greater than 0.

在my.cnf文件配置参数 

innodb_force_recovery = 6

innodb_purge_thread=0

注意: innodb_purge_thread 参数的设置为0 ,以免在配置别的值后,数据库启动会一直报错 InnoDB: Waiting for the background threads to start。



[root@Illinois ~]# service mysql start

Starting MySQL (Percona Server)..[确定]

启动成功,接下来dump 数据,接着重建库就OK了!






本文出自 “虫子” 博客,请务必保留此出处http://worms.blog.51cto.com/969144/1676738

原文:http://worms.blog.51cto.com/969144/1676738

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!