Etikettarkiv: InnoDB Recovery Tool

Så fixar du en krashad MySQL-databas

Flertalet gånger så har jag stött på problem då mysqld vägrar starta på grund av olika orsaker. Den absolut vanligaste orsaken är att hårddisken blivit full. Den näst vanligaste orsaken är att AppArmor gör DENIED då datakatalogen ligger utanför standardkatalogen för MySQL.

Men, om du nu har felsökt och stöter på problem som ger felmeddelanden såsom:

130423 13:08:09 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 709 555107725
InnoDB: 1 transaction(s) which must be rolled back or cleaned up
InnoDB: in total 1 row operations to undo
InnoDB: Trx id counter is 1 3738915328
130423 13:08:09 InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 1 2 3 4 5 InnoDB: Probable data corruption on page 14686502
InnoDB: Original record (compact record)
InnoDB: on that page.
InnoDB: Cannot find the dir slot for record (compact record)
InnoDB: on that page!
130423 13:08:09 InnoDB: Page dump in ascii and hex (16384 bytes):
InnoDB: stored checksum 1683902533, prior-to-4.0.14-form stored checksum 3027438534
InnoDB: Page lsn 709 555059595, low 4 bytes of lsn at page end 555059595
InnoDB: Page number (if stored to page already) 14686502,
InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) 0
InnoDB: Page may be an index page where index id is 0 375
130423 13:08:10 InnoDB: Assertion failure in thread 139759355893504 in file ../../../storage/innobase/page/page0page.c line 133
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.1/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
11:08:10 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

Då rekommenderar jag att du testar InnoDB recovery tool. Som återfinnes här:  InnoDB Recovery Tool. Obs du bör ha minst lika mycket hårddisk ledigt som storleken på din databas.