解决MySQL Server Crash: “InnoDB: Error: trying to access page number … which is outside the tablespace bounds.”

适用于:

MySQL服务器版本5.1到5.1 [发行版5.1]

MySQL服务器版本4.0及以上

本文信息适用于所有平台。

 

症状

当尝试在例如断电的崩溃后启动MySQL时,发生类似以下的错误:

 

InnoDB: Assertion failure in thread 4096 in file 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.
130227 11:54:17 ‐ mysqld got signal 11 ;

 

原因

这是由于InnoDB在文件系统级别的数据文件损坏导致的。

 

注意事项

许多操作系统和一些磁盘硬件愚弄flushtodisk操作。它们可能会告诉mysqld flush已经发生,即使并没有。那么写入磁盘的变化的耐久性得不到保障,而且在最坏的情况下,突然断电甚至能损坏InnoDB数据库。在SCSI磁盘控制器或在磁盘本身使用电池备用的磁盘高速缓存加快文件刷新,并使得操作更安全。你也可以尝试使用Unix命令hdparm的禁用磁盘写入硬件缓存的缓存,或使用对特定硬件供应商的一些其他命令。

 

解决方案

可以采取以下步骤从损坏中恢复:

  1. 当MySQL被关闭,通过复制所有数据库文件创建备份。

这是非常重要的,因为innodb_force_recovery的使用会导致进一步的损坏。

  1. 尝试在innodb_force_recovery启用下启动MySQL。很可能会需要很大的值。在恢复模式下,尝试转储尽可能多的数据,在这之后InnoDB必须被重新初始化。这个过程在参考手册中有描述:Starting

InnoDB on a Corrupted Database.

  1. 从备份中恢复。这通常是唯一能成功的方法。如果你选择该方法,建议首先创建损坏的文件的备份,便需要进一步从其中恢复数据。

 

参考

https://dev.mysql.com/doc/refman/5.6/en/innodbparameters. html#sysvar_innodb_force_recovery

https://dev.mysql.com/doc/refman/5.6/en/forcinginnodbrecovery.html

NOTE:1348707.1 Errors and/or Corruption when Performing DDL on Partitioned Tables

NOTE:1343198.1 InnoDB: error in sec index entry Message in MySQL Server Error Log File

NOTE:1024121.1 ” InnoDB: Warning: purge reached the head of the history list” in MySQL Error Log

NOTE:1438677.1 MySQL Server Variable: innodb_doublewrite; The InnoDB Doublewrite Buffer; Innodb_dblwr_pages_written; Innodb_dblwr_writes;

NOTE:1476982.1 What do I do with InnoDB message “Database page corruption on disk or a failed fileread of page”

 

Keywords

ASSERTION; DATA FILE; FILE SYSTEM; INNODB STORAGE ENGINE; MYSQL; PAGE NUMBER; RECOVER; SCSI; TABLESPACE


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *