wiki:howto/MysqlRepair

Version 1 (modified by Edwin Eefting, 14 years ago) (diff)

--

Corrupte InnoDB database

Dit type database heeft geen repair functie, daar deze een journal heeft. Repairen is normaal niet nodig.

De database kan echter wel corrupt raken door defecte hardware en harddisken. Let vooral op als u S.M.A.R.T. errors krijgt!

Indien u database niet meer start door een InnoDB corruptie ziet u de volgende meldingen in de logs

# less /home/system/mysql5/darkstar.err
InnoDB: Page checksum 673831230, prior-to-4.0.14-form checksum 3511409578
InnoDB: stored checksum 343549968, prior-to-4.0.14-form stored checksum 2720139525
InnoDB: Page lsn 0 3852576933, low 4 bytes of lsn at page end 67108992
InnoDB: Page number (if stored to page already) 3,
InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) 0
InnoDB: Database page corruption on disk or a failed
InnoDB: file read of page 3.
InnoDB: You may have to recover from a backup.
InnoDB: It is also possible that your operating
InnoDB: system has corrupted its own file cache
InnoDB: and rebooting your computer removes the
InnoDB: error.
InnoDB: If the corrupt page is an index page
InnoDB: you can also try to fix the corruption
InnoDB: by dumping, dropping, and reimporting
InnoDB: the corrupt table. You can use CHECK
InnoDB: TABLE to scan your table for corruption.
InnoDB: See also InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html
InnoDB: about forcing recovery.
InnoDB: Ending processing because of a corrupt database page.
InnoDB: Database page corruption on disk or a failed
InnoDB: file read of page 3.
InnoDB: You may have to recover from a backup.
101210 12:40:17  InnoDB: Page dump in ascii and hex (16384 bytes):

Handmatig de database herstellen

We volgen de instructies op http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html.

  • Zet de database uit en alle services die deze gebruiken
# svc -d /service/mysql
# svc -d /service/zarafa-server
  • Voeg innodb_force_recovery = 4 toe en herstart database in recovery mode.
    # mcedit /etc/my.cnf
    # svc -u /sevice/mysql
    # less /home/system/mysql5/darkstar.err
    
    101210 12:40:17  InnoDB: Started; log sequence number 0 4081822057
    InnoDB: !!! innodb_force_recovery is set to 4 !!!