Wednesday, May 19, 2010

External Program Corrupts MyISAM Table

There can be numerous factors responsible for the corruption of MyISAM table. Few of the most common are simultaneous modification of table by two different applications (like an external program and by the server), killing of MySQLD process in the middle of a write operation, improper system shutdown, MySQL bugs, and virus attacks. A common symptom of a MyISAM table corruption is the occurrence of the error message when the user attempts to access the records saved in the table. In such cases, the records saved in the MyISAM table become inaccessible. For easy accessibility of table records in such cases, the database user needs to restore the table from an updated backup. But, if the backup is created on a storage media that is not accessible, then the user is not left with any option, but to repair the corrupted table. To effectively do so, the user needs to use an advanced MySQL Database Repair application.

As a practical case, you use myisamchk (external program) to change the records saved in the Employee (MyISAM) table. However, that same table was also being modified by the server, at the same time. However, when the myisamchk completes its task, and you attempt to view the records saved in the Employee table, you encounter the below error message:

“Incorrect key file for table: '...'. Try to repair it”

After the above error message appears, all the records of Employee table become inaccessible. Moreover, no rows are displayed in the Employee table when you run a query.


The main cause for the corruption of the Employee table is simultaneous modification of table by both myisamchk and server.


To resolve MyISAM table corruption and to access the table data, you need to follow the below steps:
  • Use 'CHECK TABLE' command to check the health of the Employee table.
  • Use 'REPAIR TABLE' command to repair the Employee table.
While the above steps can repair Employee table in most cases, the possibility of these measures failing to repair the database table still persists. In such situations, you need to search for an effective MySQL Repair application. A MySQL Recovery tool uses powerful scanning methods to repair MyISAM table, irrespective of the degree of its damage.

Resource Link:

No comments:

Post a Comment