通常使用的 MyISAM 表可以用上面提到的恢复方法来完成。如果是索引坏了,可以用 myisamchk 工具来重建索引。而对于 Innodb 表来说,就没这么直接了,因为它把所有的表都保存在一个表空间了。不过 Innodb 有一个检查机制叫模糊检查点,只要保存了日志文件,就能根据日志文件来修复错误。可以在 my.cnf 文件中,增加以下参数,让 mysqld 在启动时自动检查日志文件:
innodb_force_recovery = 4
要保存了日志文件!!!!
100925 19:18:46 mysqld started
100925 19:18:46 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...
100925 19:18:46 InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 94 1409777360.
InnoDB: Doing recovery: scanned up to log sequence number 94 1409777360
100925 19:18:46 InnoDB: Error: page 4734977 log sequence number 94 1537001576
InnoDB: is in the future! Current system log sequence number 94 1409777360.
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.
100925 19:18:46 InnoDB: Error: page 4734991 log sequence number 94 1668918230
InnoDB: is in the future! Current system log sequence number 94 1409777360.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files.
100925 19:18:46 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...
100925 19:18:46 InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 94 1409777360.
InnoDB: Doing recovery: scanned up to log sequence number 94 1409777360
100925 19:18:46 InnoDB: Error: page 4734977 log sequence number 94 1537001576
InnoDB: is in the future! Current system log sequence number 94 1409777360.
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.
100925 19:18:46 InnoDB: Error: page 4734991 log sequence number 94 1668918230
InnoDB: is in the future! Current system log sequence number 94 1409777360.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files.
我考,没有InnoDb日志文件,彻底挂了!!!
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:http://jackxiang.com/post/3534/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
评论列表