问题
We run a MySQL Database 5.5 server on a Windows Server 2008 R2 KVM VPS, where our system automatically sets up new databases for customers as needed. A completely separate drive/partition ran out of space yesterday (had no files associated with the MySQL DB) but seemingly has corrupted the MySQL Database.
In reviewing the log files, I can see that the InnoDB is corrupted but cannot make heads or tails of what the problem is or how to resolve it. Can anyone help explain what is these errors mean so I may be able to repair it?
Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
00000001401198BD mysqld.exe!my_osmaperr()
000000014011E79A mysqld.exe!my_osmaperr()
0000000140159697 mysqld.exe!my_osmaperr()
0000000140159F53 mysqld.exe!my_osmaperr()
00000001400F05AD mysqld.exe!my_osmaperr()
00000001400F07C8 mysqld.exe!my_osmaperr()
00000001400F105C mysqld.exe!my_osmaperr()
00000001400F4FB3 mysqld.exe!my_osmaperr()
00000001400DA97C mysqld.exe!my_osmaperr()
00000001400C338C mysqld.exe!my_osmaperr()
0000000076C0652D kernel32.dll!BaseThreadInitThunk()
0000000076D3C541 ntdll.dll!RtlUserThreadStart()
InnoDB: Thread 408 stopped in file hash0hash.c line 146
http://justpaste.it/efuh
回答1:
The critical error is
140217 18:51:48 InnoDB: Assertion failure in thread 2052 in file btr0cur.c line 270
InnoDB: Failing assertion: btr_page_get_next(get_block->frame, mtr) == page_get_page_no(page)
That means that a pointer to the next page in a leaf B+tree index page points to the wrong page. Every page has its own page_id in the header.
To fix it start MySQL with innodb_force_recovery=4 and dump all tables with mysqldump in order to re-create InnoDB tablespace from scratch. It's quite probably mysqldump will fail of some tables (because there is no consistent list of page pointers). It that case dump the table in ranges of PK or use a script like this
UPDATE: Data recovery toolkit moved to GitHub
来源:https://stackoverflow.com/questions/21838337/mysql-databases-corrupted