If there is database page corruption, you may want to dump your
tables from the database with
SELECT ... INTO
OUTFILE. Usually, most of the data obtained in this
way is intact. However, it is possible that the corruption might
SELECT * FROM
InnoDB background operations to crash or
assert, or even cause
recovery to crash. In such cases, you can use the
innodb_force_recovery option to
InnoDB storage engine to start up
while preventing background operations from running, so that you
are able to dump your tables. For example, you can add the
following line to the
[mysqld] section of
your option file before restarting the server:
[mysqld] innodb_force_recovery = 1
that you have a backup copy of your database in case you need
to start over. You should always begin by setting
innodb_force_recovery to a
lower value. Incrementally increase the setting as required.
Only use an
of 3 or greater on a production server instance after you have
successfully tested the setting on separate physical copy of
innodb_force_recovery is 0 by
default (normal startup without forced recovery). The
permissible nonzero values for
innodb_force_recovery are 1 to
6. A larger value includes the functionality of lesser values.
For example, a value of 3 includes all of the functionality of
values 1 and 2. If you are able to dump your tables with an
option value of at most 3, then you are relatively safe that
only some data on corrupt individual pages is lost. A value of 6
is considered drastic because database pages are left in an
obsolete state, which in turn may introduce more corruption into
B-trees and other database structures.
Let the server run even if it detects a corrupt page. Try to
SELECT * FROM
corrupt index records and pages, which helps in dumping
Prevent the main thread from running. If a crash would occur during the purge operation, this recovery value prevents it.
Do not run transaction rollbacks after recovery.
Prevent insert buffer merge operations. If they would cause a crash, do not do them. Do not calculate table statistics.
Do not look at undo logs when starting the database:
InnoDB treats even incomplete
transactions as committed.
Do not do the log roll-forward in connection with recovery.
The database must not otherwise be used with any
nonzero value of
As a safety measure,
InnoDB prevents users
DELETE operations when
greater than 0.
SELECT from tables to
dump them, or
CREATE tables even if forced recovery is
used. If you know that a given table is causing a crash on
rollback, you can drop it. You can also use this to stop a
runaway rollback caused by a failing mass import or
ALTER TABLE. You can kill the
mysqld process and set
3 to bring the database up without the
DROP the table that is causing
the runaway rollback.