утилита для обслуживания таблиц MyISAM (MyISAM table-maintenance utility)
MYISAMCHK REPAIR OPTIONS
myisamchk
supports the following options for table repair
operations (operations performed when an option such as --recover
or --safe-recover
is given):
• --backup
, -B
Make a backup of the .MYD file as file_name-time.BAK
• --character-sets-dir=
path
The directory where character sets are installed.
• --correct-checksum
Correct the checksum information for the table.
• --create-missing-keys
Create missing keys. This assumes that the data file is
correct and that the number of rows stored in the index file
is correct. Enables --quick
.
• --data-file-length=
len, -D
len
The maximum length of the data file (when re-creating data
file when it is 'full').
• --extend-check
, -e
Do a repair that tries to recover every possible row from the
data file. Normally, this also finds a lot of garbage rows.
Do not use this option unless you are desperate.
For a description of the output format, see the section
called 'MYISAMCHK TABLE INFORMATION'.
• --force
, -f
Overwrite old intermediate files (files with names like
tbl_name.TMD) instead of aborting. Add another --force
to
avoid 'myisam_sort_buffer_size is too small' errors. In this
case we will attempt to do the repair with the given
myisam_sort_buffer_size
and dynamically allocate as many
management buffers as needed.
• --keys-used=
val, -k
val
For myisamchk
, the option value is a bit-value that indicates
which indexes to update. Each binary bit of the option value
corresponds to a table index, where the first index is bit 0.
An option value of 0 disables updates to all indexes, which
can be used to get faster inserts. Deactivated indexes can be
reactivated by using myisamchk -r
.
• --max-record-length=
len
Skip rows larger than the given length if myisamchk
cannot
allocate memory to hold them.
• --parallel-recover
, -p
Use the same technique as -r
and -n
, but create all the keys
in parallel, using different threads. This is beta-quality
code. Use at your own risk!
• --quick
, -q
Achieve a faster repair by modifying only the index file, not
the data file. You can specify this option twice to force
myisamchk
to modify the original data file in case of
duplicate keys. NOTE: Tables where the data file is corrupted
can't be fixed with this option.
• --recover
, -r
Do a repair that can fix almost any problem except unique
keys that are not unique (which is an extremely unlikely
error with MyISAM tables). If you want to recover a table,
this is the option to try first. You should try
--safe-recover
only if myisamchk
reports that the table
cannot be recovered using --recover
. (In the unlikely case
that --recover
fails, the data file remains intact.)
If you have lots of memory, you should increase the value of
sort_buffer_size.
• --safe-recover
, -o
Do a repair using an old recovery method that reads through
all rows in order and updates all index trees based on the
rows found. This is an order of magnitude slower than
--recover
, but can handle a couple of very unlikely cases
that --recover
cannot. This recovery method also uses much
less disk space than --recover
. Normally, you should repair
first using --recover
, and then with --safe-recover
only if
--recover
fails.
If you have lots of memory, you should increase the value of
key_buffer_size.
• --set-collation=
name
Specify the collation to use for sorting table indexes. The
character set name is implied by the first part of the
collation name.
• --sort-recover
, -n
Force myisamchk
to use sorting to resolve the keys even if
the temporary files would be very large.
• --tmpdir=
path, -t
path
The path of the directory to be used for storing temporary
files. If this is not set, myisamchk
uses the value of the
TMPDIR environment variable. tmpdir can be set to a list of
directory paths that are used successively in round-robin
fashion for creating temporary files. The separator character
between directory names is the colon (':') on Unix and the
semicolon (';') on Windows, NetWare, and OS/2.
• --unpack
, -u
Unpack a table that was packed with myisampack
.