“Table ‘table_name’ is marked as crashed and should be repaired ….” şeklinde bir uyarı mesajı alıyor ve veritabanı engine olarak myisam kullanıyorsanız corrupt olmuş tablo/tabloları düzeltmek için myisamchk kullanabilirsiniz.Problemli tablo veya mevcut veritabanı içerisindeki diğer tabloların boyutu büyükse, checking ve reparing işlemi biraz uzayabilir.Bu durumda, eğer operating sistem üzerinde yeterli memory varsa mysql’in buffer parametlerini kullanarak komutun daha hızlı çalışmasını sağlayabilirsiniz.

532MB genişliğinde olan hedef  bir tablo’nun check ve repair edilmesi:

myisamchk -c -i -v -s -f -U oz_stats_counter.MYI  --key_buffer_size=512M --sort_buffer_size=512M \
 --read_buffer_size=8M --write_buffer_size=6M \ oz_stats_counter.MYI

Checking MyISAM file: oz_stats_counter.MYI
myisamchk: MyISAM file oz_stats_counter.MYI
myisamchk: warning: Table is marked as crashed
No recordlinks
block_size 1024:
myisamchk: error: Key in wrong position at page 539734016
  - Searching for keys, allocating buffer for 16576362 keys
  - Dumping 16576360 key
Komut seçenekleri hakkında detaylı bilgi:
myisamchk --help
Share on Facebook

MyISAM engine yapısına sahip tablolar hakkında “myisamchk” ile detaylı bilgi almak mümkün.

myisamchk -dv oz_users.MYI

MyISAM file:         oz_users.MYI
Record format:       Packed
Character set:       latin1_swedish_ci (8)
File-version:        1
Creation time:       2011-04-16 11:52:43
Status:              open,changed
Auto increment key:              1  Last value:                102307
Data records:                98296  Deleted blocks:                 0
Datafile parts:              98524  Deleted data:                   0
Datafile pointer (bytes):        6  Keyfile pointer (bytes):        6
Datafile length:          22651516  Keyfile length:           7384064
Max datafile length: 281474976710654  Max keyfile length: 288230376151710719
Recordlength:                  948

table description:
Key Start Len Index   Type                     Rec/key         Root  Blocksize
1   1     4   unique  unsigned long                  1       300032       1024
2   1     4   unique  unsigned long prefix           0      7077888       1024
    843   100         varchar                        1

Share on Facebook