PrécédentTable des matière Suivant
 

13.1 Utiliser isamchk pour la maintenance et la réparation

To check/repair ISAM tables (.ISM and .ISD) you should use the isamchk utility. To check/repair MyISAM tables (.MYI and .MYD) you should use the myisamchk utility. Confère section 10.18 Types de tables MySQL.

In the following text we will talk about isamchk but everything also applies to myisamchk.

You can use the isamchk utility to get information about your database tables, check and repair them or optimize them. The following sections describe how to invoke isamchk (including a description of its options), how to set up a table maintenance schedule, and how to use isamchk to perform its various functions.

If you run mysqld with --skip-locking (which is the default on some systems, like Linux), you can't reliably use isamchk to check a table when mysqld is using the same table. If you can be sure that no one is accessing the tables through mysqld while you run isamchk, you only have to do mysqladmin flush-tables before you start checking the tables. If you can't guarantee the above, then you must take down mysqld while you check the tables. If you run isamchk while mysqld is updating the tables, you may get a warning that a table is corrupt even if it isn't.

If you are not using --skip-locking, you can use isamchk to check tables at any time. While you do this, all clients that try to update the table will wait until isamchk is ready before continuing.

If you use isamchk to repair or optimize tables, you MUST always ensure that the mysqld server is not using the table (this also applies if you are using --skip-locking). If you don't take down mysqld you should at least do a mysqladmin flush-tables before you run isamchk.

You can in most cases also use the command OPTIMIZE TABLES to optimize and repair tables, but this is not as fast or reliable (in case of real fatal errors) as isamchk. On the other hand, OPTIMIZE TABLE is easier to use and you don't have to worry about flushing tables. Confère section 7.8 OPTIMIZE TABLE.

Table des matières
PrécédentNexen.netSuivant