table 깨져서 insert 등이 안될때 repair 방법 정보
MySQL table 깨져서 insert 등이 안될때 repair 방법본문
table 이 깨지는 경우가 종종 발생합니다.
특히 DB이전이나 backup restore 하는 경우에 발생하더군요.
이때에는 repair 를 해 주면 잘 동작합니다.
그것과 관련해서 설정도 약간 변경해 주면 좋습니다.
/* my.cnf 수정 */
/etc/my.cnf
[mysqld]
innodb_force_recovery = 4
/* 테이블 확인하고 repair */
mysql> CHECK TABLE ratedtext;
+-------------------+-------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+-------------------+-------+----------+----------+
| wikidb4.ratedtext | check | status | OK |
+-------------------+-------+----------+----------+
1 row in set (5 min 30.96 sec)
mysql> SELECT * FROM mydb.ratedtext INTO OUTFILE '/home/mingus/ratedtext.sql'
ERROR 1034 (HY000): Incorrect key file for table 'ratedtext'; try to repair it
mysql> repair table ratedtext;
+-------------------+--------+----------+---------------------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+-------------------+--------+----------+---------------------------------------------------------+
| wikidb4.ratedtext | repair | note | The storage engine for the table doesn't support repair |
+-------------------+--------+----------+---------------------------------------------------------+
1 row in set (0.03 sec)
2