is marked as crashed and should be repaired when using LOCK TABLES

备份数据库时,报错:
mysqldump: Got error: 145: Table './dzstat/stat_active_201110' is marked as crashed and should be repaired when using LOCK TABLES

进入数据库对该表进行检测:mysql> check table stat_active_201110;
+---------------------------+-------+----------+--------------------------------------------------------------------+
| Table                     | Op    | Msg_type | Msg_text                                                           |
+---------------------------+-------+----------+--------------------------------------------------------------------+
| dzstat.stat_active_201110 | check | warning  | Table is marked as crashed                                         |
| dzstat.stat_active_201110 | check | warning  | 1 client is using or hasn't closed the table properly              |
| dzstat.stat_active_201110 | check | error    | Found key at page 111371264 that points to record outside datafile |
| dzstat.stat_active_201110 | check | error    | Corrupt                                                            |
+---------------------------+-------+----------+--------------------------------------------------------------------+
4 rows in set (17.44 sec)
解决办法:mysql> repair table stat_active_201110;
+---------------------------+--------+----------+----------+
| Table                     | Op     | Msg_type | Msg_text |
+---------------------------+--------+----------+----------+
| dzstat.stat_active_201110 | repair | status   | OK       |
+---------------------------+--------+----------+----------+
1 row in set (29.81 sec)
再次检测:mysql> check table stat_active_201110;
+---------------------------+-------+----------+----------+
| Table                     | Op    | Msg_type | Msg_text |
+---------------------------+-------+----------+----------+
| dzstat.stat_active_201110 | check | status   | OK       |
+---------------------------+-------+----------+----------+
1 row in set (5.19 sec)
这样就ok了

添加新评论 »