2003-11-17
203 HIT
|
| http://ilinuxbay.com/contentChannel/article.php?scol_serial=1894&aca_idx=4 어느날 아침 로긴이 안되거나 혹은 게시판에서 데이터 베이스 엑세스를 할수 없습니다.. 이런 메세지를 볼수 있다. 난감하기 그지 없다... 어떻게 극복을 할것인가... ? 데이터 베이스는 항상 깨지기 마련이다. 1년은 운영한다면.. 적어도 1~2회 정도는 화일을 열수 없습니다. 에러 메세지 : ERROR 1016: Can't open file: 'xxxxxx.MYD'. (errno: 145) 만약 /usr/local/mysql/var/데이터 베이스에 들어 가면 각각의 부분에 대하여 *.FRM : 테이블 정보 *.MYI : 인덱스 정보 *.MYD : 데이타 정보 [ root@ilinuxbay ]# /usr/local/mysql/bin/myisamchk sessions.* myisamchk: error: 'sessions.MYD' is not a MyISAM-table --------- Checking MyISAM file: sessions.MYI Data records: 6 Deleted blocks: 6 myisamchk: warning: Table is marked as crashed - check file-size - check key delete-chain - check record delete-chain myisamchk: warning: Not used space is supposed to be: 896 but is: 624 myisamchk: error: record delete-link-chain corrupted - check index reference - check data record references index: 1 myisamchk: error: Found 4 keys of 6 - check record links myisamchk: error: Record-count is not ok; is 4 Should be: 6 myisamchk: warning: Found 4 deleted blocks Should be: 6 myisamchk: warning: Found 8 parts Should be: 11 parts MyISAM-table 'sessions.MYI' is corrupted Fix it using switch "-r" or "-o" --------- 누가 지웠나.. 혹은 화일이 없는 경우 다음과 같은 명령어를 이용 확인 복구를 할 수 있다. ]#myisamchk 옵션을 보면 # -r -o로 복구가 안되면다 -f 옵션을 이용한다. -f, --force Overwrite old temporary files. #복구 -r, --recover Can fix almost anything except unique keys that aren't unique. #안전하게 복구 -o, --safe-recover Uses old recovery method; Slower than '-r' but can handle a couple of cases where '-r' reports that it can't fix the data file. #데이터 정렬 및 속도 증가 -R1 저도 주면 될듯 싶네요 -R, --sort-records=# Sort records according to an index. This makes your data much more localized and may speed up things 일반적으로 -r 을 기본으로 사용하며 대상 화일은 * 확장자를 잡으면 된다. 그럼 복구를 해보자. [ root@ilinuxbay ]# /usr/local/mysql/bin/myisamchk -r sessions.* myisamchk: error: 'sessions.MYD' is not a MyISAM-table --------- - recovering (with sort) MyISAM-table 'sessions.MYI' Data records: 6 - Fixing index 1 Data records: 4 --------- 혹 구버전인 경우 isamchk 명령어를 이용 복구 가능합니다. 가능한 데이터베이스를 정지하고 하세요. 그럼.. 무운을 빕니다. 전 복구 했어요. |

