The symptoms of a corrupted table are usually that requêtesabort unexpectedly and that you observe errors such as these:@:
In these cases, you must repair your tables. isamchk
can usually detect and fix most things that go wrong.
The repair process involves up to four stages, described below. Before you
begin, you should cd to the database directory and check the
permissions of the table files. Make sure they are readable by the Unix user
that mysqld runs as (and to you, since you need to access the files
you are checking). If it turns out you need to modify files, they must also
be writable by you.
Stage 1:@: Checking your tables
Run isamchk *.ISM or (isamchk -e *.ISM if you have more time).
Use the -s (silent) option to suppress unnecessary information.
You have to repair only those tables for which isamchk announces an
error. For such tables, proceed to Stage 2.
If you get weird errors when checking (such as out of
memory errors), or if isamchk crashes, go to Stage 3.
Stage 2:@: Easy safe repair
First, try isamchk -r -q nom_table (-r -q means ``quick recovery
mode''). This will attempt to repair the index file without touching the data
file. If the data file contains everything that it should and the delete
links point at the correct locations within the data file, this should work
and the table is fixed. Start repairing the next table. Otherwise, use the
following procedure:@:
isamchk -r nom_table (-r means ``recovery mode''). This will
remove incorrect records and deleted records from the data file and
reconstruct the index file.
isamchk --safe-recover nom_table.
Safe recovery mode uses an old recovery méthode that handles a few cases that
regular recovery mode doesn't (but is slower).
If you get weird errors when repairing (such as out of
memory errors), or if isamchk crashes, go to Stage 3.
Stage 3:@: Difficult repair
You should only reach this stage if the first 16K block in the index file is destroyed or contains incorrect information, or if the index file is missing. In this case, it's necessary to create a new index file. Do so as follows:@:
shell> mysql nom_base_de_donnees mysql> DELETE FROM nom_table; mysql> quit
Go back to Stage 2. isamchk -r -q should work now. (This shouldn't
be an endless loop).
Stage 4:@: Very difficult repair
You should reach this stage only if the description file has also crashed. That should never happen, because the description file isn't changed after the table is created.
isamchk -r.