myisamchk “A super tool to view and repair corrupt databases”
The myisamchk utility gets information about your database tables or checks, repairs, or optimizes them. myisamchk works with MyISAM tables (tables that have .MYD and .MYI files for storing data and indexes).
Caution
It is best to make a backup of a table before performing a table repair operation; under some circumstances the operation might cause data loss. Possible causes include but are not limited to file system errors.
To find the tables that are corrupt and to output it to a file run the following script
find -name “*.MYI” -exec myisamchk -c {} \; > /root/tbl_chk
To view the number of tables corrupt
cat /root/tbl_chk | grep MyISAM | wc -l
To repair the corrupt tables
find / -name “*.MYI” -exec myisamchk -r {} \;
No comments:
Post a Comment