Tuesday, April 20, 2010

Three ways to Repair MyISAM tables

Corruption in MyISAM tables is a nightmare for almost every Database Administrator (DBA). These tables are one of the most important components to save personal and professional data, and corruption of these tables primarily result into inaccessibility of all that data. In such cases, a valid database backup allows you to restore the data and access the table records. While the backup file is mostly saved on a different storage media, the possibilities of its corruption still exist. In such cases, you will need to perform Repair MySQL Database.

Below are the few error messages that enable you to identify that your MyISAM table (employee) is corrupt:

“employee.frm is locked against change”
“Can't find file employee.MYI (Errcode: nnn)”
“Got error employee from table handler”

The data stored in the employee table becomes inaccessible after the above error message pops up. In addition, you receive any of the above error message each time you attempt to access the table.


Few main reasons for the employee table corruption are improper MySQL Server shutdown, virus infection, file system damage, and human errors.


To resolve the above error messages and access the employee table records, you will need to follow the below measures:

You can use an in-built tool “myisamchk” to check and repair the employee table. The command-line tool scans the database components, identifies the exact cause of corruption, and repair the tables.

You can use various SQL commands to repair the employee table. These commands are CHECK TABLE, REPAIR TABLE, and OPTIMIZE TABLE.

The probabilities of employee table not being repaired by any of the above steps is very less, but still exists. Such cases occur when the table is badly corrupted. To repair the table in such situations, you will need to use an advanced third-party Repair MySQL tool.

1 comment:

  1. For resolving out sql server problems you may use mdf repair. It owns all necessary probabilities such as repairing after various power failures, viruses, hacker attacks. The tool views results of restored mdf files and starts under all Windows OS.