All pages
Powered by GitBook
1 of 1

Loading...

REPAIR TABLE

Repair corrupted tables. This statement fixes errors in tables for supported storage engines like MyISAM, Aria, and Archive.

Syntax

REPAIR [NO_WRITE_TO_BINLOG | LOCAL] TABLE
    tbl_name [, tbl_name] ...
    [QUICK] [EXTENDED] [USE_FRM] [FORCE
REPAIR [NO_WRITE_TO_BINLOG | LOCAL] TABLE
    tbl_name [, tbl_name] ...
    [QUICK] [EXTENDED] [USE_FRM]

Description

REPAIR TABLE repairs a possibly corrupted table. By default, it has the same effect as

or

See and for more.

REPAIR TABLE works for , , , and tables. For , see . For CSV, see also . For Archive, this statement also improves compression. If the storage engine does not support this statement, a warning is issued.

This statement requires for the table.

By default, REPAIR TABLE statements are written to the and will be . The NO_WRITE_TO_BINLOG keyword (LOCAL is an alias) will ensure the statement is not written to the binary log.

REPAIR TABLE statements are not logged to the binary log if is set. See also .

REPAIR TABLE statements are logged to the binary log.

When an index is recreated, the storage engine may use a configurable buffer in the process. Incrementing the buffer speeds up the index creation. and allocate a buffer whose size is defined by or , also used for .

QUICK

When specified, REPAIR TABLE will not modify the data file, only attempting to repair the index file. The same behavior can be achieved with .

EXTENDED

Creates the index row by row rather than sorting and creating a single index. Similar to .

USE_FRM

For use only when the index file is missing or its header corrupted. MariaDB then attempts to recreate it using the .frm file. There is no equivalent option.

FORCE

The FORCE argument allows to first run internal repair to fix damaged blocks and then follow it up with ALTER TABLE ().

The FORCE option is not available.

Partitioned Tables

REPAIR TABLE is also supported for with the statement. However, the USE_FRM option cannot be used with this statement on a partitioned table. See for details.

Progress Reporting

The storage engine supports for this statement.

See Also

This page is licensed: GPLv2, originally from

aria_chk
myisamchk
Archive
Aria
CSV
MyISAM
InnoDB
recovery modes
Checking and Repairing CSV Tables
SELECT and INSERT privileges
binary log
replicated
read_only
Read-Only Replicas
Aria
MyISAM
aria_sort_buffer_size
myisam_sort_buffer_size
ALTER TABLE
myisamchk --recover --quick
myisamchk --safe-recover
myisamchk
MDEV-33449
partitioned tables
ALTER TABLE ... REPAIR PARTITION
Repairing Partitions
Aria
mariadb-check
aria_chk
myisamchk
fill_help_tables.sql
myisamchk --recover tbl_name
aria_chk --recover tbl_name
progress reporting