断电后 MySQL InnoDB 损坏,可以恢复吗?

断电后 MySQL InnoDB 损坏,可以恢复吗?

最近,在一次断电事故似乎损坏了 MySQL 中的 InnoDB 数据库后,我开始尝试启动并运行 Redmine。即使 Redmine 无法运行,我也希望获得大量文档。服务在启动时失败。我尝试根据错误日志中 URL 中的文档插入 innodb_force_recovery = 4。(还尝试了 1 到 6,因为我在损坏后备份了所有目录)我已通过“mysqld-nt --print-defaults”验证它是否从参数中的恢复选项开始。

该机器运行的是 Windows Server 2003 SP2、Xeon E5335,配备 2GB RAM,MySQL 没有镜像到另一台机器,该机器也不是镜像。我没有任何备份,因为之前的人没有设置它们。

以下是错误日志:

InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
100308 14:50:01  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...
100308 14:50:02  InnoDB: Error: page 7 log sequence number 0 935521175
InnoDB: is in the future! Current system log sequence number 0 933419020.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html
InnoDB: for more information.
100308 14:50:02  InnoDB: Error: page 2 log sequence number 0 935517607
InnoDB: is in the future! Current system log sequence number 0 933419020.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html
InnoDB: for more information.
100308 14:50:02  InnoDB: Error: page 11 log sequence number 0 935517607
InnoDB: is in the future! Current system log sequence number 0 933419020.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html
InnoDB: for more information.
100308 14:50:02  InnoDB: Error: page 5 log sequence number 0 972973045
InnoDB: is in the future! Current system log sequence number 0 933419020.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html
InnoDB: for more information.
100308 14:50:02  InnoDB: Error: page 6 log sequence number 0 972984051
InnoDB: is in the future! Current system log sequence number 0 933419020.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html
InnoDB: for more information.
100308 14:50:02  InnoDB: Error: page 1577 log sequence number 0 972737368
InnoDB: is in the future! Current system log sequence number 0 933419020.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html
InnoDB: for more information.
InnoDB: Error: trying to access page number 4294965119 in space 0,
InnoDB: space name .\ibdata1,
InnoDB: which is outside the tablespace bounds.
InnoDB: Byte offset 0, len 16384, i/o type 10.
InnoDB: If you get this error at mysqld startup, please check that
InnoDB: your my.cnf matches the ibdata files that you have in the
InnoDB: MySQL server.
100308 14:50:02InnoDB: Assertion failure in thread 960 in file .\fil\fil0fil.c line 3959
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html
InnoDB: about forcing recovery.
100308 14:50:02 [ERROR] mysqld-nt: Got signal 11. Aborting!

100308 14:50:02 [ERROR] Aborting

100308 14:50:02 [Note] mysqld-nt: Shutdown complete

答案1

我最近遇到了这个问题,无法“恢复”,但可以在设置 innodb_force_recovery 时使用 mysqldump,然后使用它重新创建数据库。如果由于错误而无法转储数据,请参阅:

http://www.mysqlperformanceblog.com/2008/07/04/recovering-innodb-table-corruption/

制定一个策略来找出‘坏’数据,并剔除‘好’数据。

答案2

100308 14:50:02 InnoDB:错误:第 7 页日志序列号 0 935521175 InnoDB:是在未来

MySQL 对日期时间和文件时间戳很敏感。检查日期时间是否已更新,并验证日志文件的时间戳。

相关内容