Microsoft Word - Sam's Teach Yourself MySQL in 21 Days - SAMS.doc

(singke) #1
ƒ -e, --extend-check Checks a file very thoroughly. Not normally required because
isamchk should find most errors without this option.
ƒ -f, --force Overwrites temporary files.
ƒ -i, --information Shows statistical information about the table.
ƒ -k=num, --keys-used=num Used with -r, tells isamchk to drop the first num keys
before repairing.
ƒ -l, --no-symlinks Tells isamchk not to follow symbolic file links (it will follow
them by default).
ƒ -q, --quick Used with -r for a faster repair. Only repairs .ISD files but not data
files, unless an optional second -q is specified, in which case data files are repaired
too.
ƒ -r, --recover Performs recovery. This will fix most problems with the exception of
unique key violations.
ƒ -o, --safe_recover Uses the old recovery method. This is slower than -r.
ƒ -s, --silent Prints errors only. Specify -ss for very silent.
ƒ -v, --verbose Prints more information. Specify -vv for very verbose.
ƒ -S, --sort-index Sorts index blocks for some speed improvement in applications
doing a lot of "read next" operations.
ƒ -R=index, --sort-records=index Sorts actual data records according to a
given index. This may give speed improvements with some queries.
ƒ -u, --unpack Unpacks a file packed with pack_isam.
ƒ -V, --version Displays the version number and exits.
ƒ -W, --wait Waits before processing if table is locked.
ƒ -?, --help Shows full list of isamchk options.

Now you'll look at just a few of these options in a little more detail.

Quick Repairs


For a quick repair on a table or tables, use the following syntax:


isamchk -rq table_name

A sample quick repair might look like the following:
[root@tigger book]# isamchk -rq customers


  • check delete-chain

  • recovering ISAM-table 'customers.ISM'
    Data records: 15

  • Fixing index 1
    This will perform a check and effect repairs if need be. It is a "quick" check because it only looks at the
    .ISM file, not the .ISD (data) file.
    However, you can supply a second -q to force isamchk to alter its behavior and fix the data file too.


For a more extensive check on the data, use the following:
isamchk -e table_name
This checks the both .ISM and .ISD files. It takes a much closer look for any possible corruption. It will
fix most problems, but it will exit if it finds a severe error.
isamchk -ev table_name
is a verbose form of the previous command and differs in that it will keep going if it finds a severe error,
deleting any offending data if necessary. For this reason, it's wise to make a backup of your data before
starting isamchk repairs. It's also a good idea to run the commands one at a time in the order shown
previously, progressively burrowing into the data, to get a feel for the extent of corruption before going
for an extended fix.

Fixing Problems with Keys


Although keys (or indexes) are usually intended to improve database performance, there are times when
they impede performance, such as in INSERT or UPDATE operations.

Free download pdf