Repairing tables
When a table is damaged, sometimes replacing it with a backup is not necessary. It is certainly a solution, but it implies some data loss unless the table is unchanged since the last backup. When possible, repairing the damaged table is a better solution.
The procedure we must follow to repair the table depends on the storage engine.
InnoDB has a recovery process that is launched on server startup. While this process is automatic, it must be configured by the DBA.
MyISAM and Aria also have an automatic recovery process on startup. But they also support recovery via the REPAIR TABLE SQL
statement or when the server is stopped, via specific tools distributed with MariaDB.
Other storage engines also support REPAIR TABLE
.
Note
Some repairing techniques are considered less safe than others. However, even when the safest method is used, it might still fail to recover the table and cause more corruption. The possibility is usually very small, but it exists. For this reason, it is always...