13.1 Utiliser isamchk pour la maintenance et la réparation

Pour vérifier/réparer les tables ISAM (.ISM et .ISD), vous devez utiliser l'utilitaire : isamchk. Pour vérifier/réparer les tables MyISAM (.MYI et .MYD) vous devez utiliser utiliser l'utilitaire myisamchk. 10.18 Types de tables MySQL.

Par la suite, nous traiterons le cas de isamchk mais les instructions pourront aussi s'appliquer ˆ myisamchk.

Vous pouvez utiliser l'utilitaire isamchk pour receuillir des informations sur votre base de données et ses tables, pour vérifier et réparer les tables ou encore les optimiser. La section suivante décrit les commandes d'invocations de isamchk (y compris les options), les méthodes de maintenance régulière, et comment utiliser isamchk pour effectuer diverses tàches.

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. OPTIMIZE TABLE.

Sommaire: