Movatterモバイル変換


[0]ホーム

URL:


X

Copyright © 2025 MariaDB. All rights reserved.

Created
14 years, 7 months ago
Modified
10 months, 1 week ago
Type
article
Status
active
License
GPLv2 fill_help_tables.sql
Attachments
No attachments exist
Localized Versions
Product Versions

REPAIR TABLE

Syntax

<=MariaDB 11.4

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

>=MariaDB 11.5

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

Description

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

myisamchk --recover tbl_name

or

aria_chk --recover tbl_name

Seearia_chk andmyisamchk for more.

REPAIR TABLE works forArchive,Aria,CSV andMyISAM tables. ForInnoDB, seerecovery modes. For CSV, see alsoChecking and Repairing CSV Tables. For Archive, this statement also improves compression. If the storage engine does not support this statement, a warning is issued.

This statement requiresSELECT and INSERT privileges for the table.

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

FromMariaDB 10.3.19,REPAIR TABLE statements are not logged to the binary log ifread_only is set. See alsoRead-Only Replicas.

When an index is recreated, the storage engine may use a configurable buffer in the process. Incrementing the buffer speeds up the index creation.Aria andMyISAM allocate a buffer whose size is defined byaria_sort_buffer_size ormyisam_sort_buffer_size, also used forALTER TABLE.

QUICK

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

EXTENDED

Creates the index row by row rather than sorting and creating a single index. Similar tomyisamchk --safe-recover.

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 equivalentmyisamchk option.

MariaDB starting with11.5

FORCE

The FORCE argument was added inMariaDB 11.5 to allow one to first run internal repair to fix damaged blocks and then follow it with ALTER TABLE (MDEV-33449).

Partitioned Tables

REPAIR TABLE is also supported forpartitioned tables with theALTER TABLE ... REPAIR PARTITION statement. However, theUSE_FRM option cannot be used with this statement on a partitioned table. SeeRepairing Partitions for details.

Progress Reporting

TheAria storage engine supportsprogress reporting for this statement.

See Also

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.

[8]ページ先頭

©2009-2025 Movatter.jp