Error 1194: Table is marked as crashed and should be repaired
1194
HY000
ER_CRASHED_ON_USAGE
Table '%s' is marked as crashed and should be repaired
Possible Causes and Solutions
This error occurs, in particular to MyISAM, Aria, Archive or CSV tables, if the table is marked as crashed. This can occur for a number of reasons, for example:
running out of disk space
sudden shutdown while the table was in use
damage to the table's data or index files, for example by a storage problem or by a program that changed the files while the server used them
InnoDB tables recover from a crash with InnoDB's own crash recovery when the server starts, and don't get marked as crashed. InnoDB returns this error only when the table definition and InnoDB's data dictionary don't agree on the number of columns. The error log then says Table … contains N user defined columns in InnoDB, but M columns in MariaDB. REPAIR TABLE doesn't help in that case. See InnoDB Data Dictionary Troubleshooting.
When the server opens a MyISAM or Aria table that is marked as crashed, it first tries to repair it, as set by myisam_recover_options and aria_recover_options. Both default to BACKUP,QUICK. A quick repair can't fix a damaged data file, so the statement then fails with this error, and the error log shows the attempt:
[ERROR] mariadbd: Table './shop/m1' is marked as crashed and should be repaired
[Warning] Checking table: './shop/m1'
[Warning] Recovering table: './shop/m1'
[ERROR] Couldn't repair table: shop.m1To solve the error:
Run CHECK TABLE to see what is damaged, then REPAIR TABLE. Outside the server, the same can be done with mariadb-check, or, with the server stopped or the table locked, with myisamchk or aria_chk.
Check the warnings of
REPAIR TABLE. When the data file is damaged, the repair keeps only the rows it can read, and reports how many there are. For example,Number of rows changed from 2000 to 500. If the lost rows matter, restore the table from a backup instead.Find the cause, for example a full disk or an unclean shutdown, so that the table doesn't crash again. For data that must survive a crash, consider InnoDB, or a transactional Aria table.
Related errors: a damaged index gives error 1034 (Index for table … is corrupt; try to repair it), and a table whose last repair failed or was interrupted gives error 1195 (Table … is marked as crashed and last (automatic?) repair failed).
This page is licensed: CC BY-SA / Gnu FDL
Last updated
Was this helpful?

