2009년 9월 17일 목요일

mysql table 점검 / 복구하기

    DB 테이블 점검
    DB명 : trumpeter
    Table명 : zetyx_board_lee

    trumpeter.zetyx_board_lee | check | error    | File '/usr/local/mysql/data/trumpeter/zetyx_board_lee.MYD' not found (Errcode: 13)

    파일 유무 확인 및 퍼미션 변경
    # ll /usr/local/mysql/data/trumpeter/zetyx_board_lee*
    -rw-r-----  1 root  root  94244  8월 22 15:00 /usr/local/mysql/data/trumpeter/zetyx_board_lee.MYD
    -rw-rw----  1 mysql mysql 17408  8월 22 14:09 /usr/local/mysql/data/trumpeter/zetyx_board_lee.MYI
    -rw-rw----  1 mysql mysql 13760  7월 25  2006 /usr/local/mysql/data/trumpeter/zetyx_board_lee.frm

    MYD파일 퍼미션 및 소유자 변경
    > -rw-rw----  1 mysql mysql 94244  8월 22 15:00 /usr/local/mysql/data/trumpeter/zetyx_board_lee.MYD


    1차 data 백업
    /usr/local/mysql/data 디렉토리를
    /usr/local/mysql/data.bak.090917 로 백업(복사)


    DB 테이블 복구

mysql> check table zetyx_board_lee;
+---------------------------+-------+----------+--------------------------------------------------------+
| Table                     | Op    | Msg_type | Msg_text                                               |
+---------------------------+-------+----------+--------------------------------------------------------+
| trumpeter.zetyx_board_lee | check | warning  | Table is marked as crashed                             |
| trumpeter.zetyx_board_lee | check | warning  | 2 clients is using or hasn't closed the table properly |
| trumpeter.zetyx_board_lee | check | error    | Checksum for key: 9 doesn't match checksum for records |
| trumpeter.zetyx_board_lee | check | error    | Corrupt                                                |

+---------------------------+-------+----------+--------------------------------------------------------+
4 rows in set (0.00 sec)

mysql> repair table zetyx_board_lee;
+---------------------------+--------+----------+----------+
| Table                     | Op     | Msg_type | Msg_text |
+---------------------------+--------+----------+----------+
| trumpeter.zetyx_board_lee | repair | status   | OK       |
+---------------------------+--------+----------+----------+
1 row in set (0.04 sec)

mysql> check table zetyx_board_lee;
+---------------------------+-------+----------+----------+
| Table                     | Op    | Msg_type | Msg_text |
+---------------------------+-------+----------+----------+
| trumpeter.zetyx_board_lee | check | status   | OK       |
+---------------------------+-------+----------+----------+
1 row in set (0.00 sec)

댓글 없음:

댓글 쓰기