Rechercher dans le manuel MySQL
15.20.3 Troubleshooting InnoDB Data Dictionary Operations
Information about table definitions is stored in the InnoDB data dictionary. If you move data files around, dictionary data can become inconsistent.
If a data dictionary corruption or consistency issue prevents you
from starting InnoDB
, see
Section 15.20.2, “Forcing InnoDB Recovery” for information about
manual recovery.
Cannot Open Datafile
With innodb_file_per_table
enabled (the default), the following messages may appear at
startup if a
file-per-table
tablespace file (.ibd
file) is missing:
[ERROR] InnoDB: Operating system error number 2 in a file operation.
[ERROR] InnoDB: The error means the system cannot find the path specified.
[ERROR] InnoDB: Cannot open datafile for read-only: './test/t1.ibd' OS error: 71
[Warning] InnoDB: Ignoring tablespace `test/t1` because it could not be opened.
To address the these messages, issue DROP
TABLE
statement to remove data about the missing table
from the data dictionary.
This procedure describes how to restore orphan
file-per-table
.ibd
files to another MySQL instance. You
might use this procedure if the system tablespace is lost or
unrecoverable and you want to restore .ibd
file backups on a new MySQL instance.
The procedure is not supported for
general
tablespace .ibd
files.
The procedure assumes that you only have
.ibd
file backups, you are recovering to
the same version of MySQL that initially created the orphan
.ibd
files, and that
.ibd
file backups are clean. See
Section 15.6.1.2, “Moving or Copying InnoDB Tables” for information about
creating clean backups.
Tablespace copying limitations outlined in Section 15.6.3.7, “Copying Tablespaces to Another Instance” are applicable to this procedure.
On the new MySQL instance, recreate the table in a database of the same name.
Discard the tablespace of the newly created table.
Copy the orphan
.ibd
file from your backup directory to the new database directory.shell> cp /backup_directory/actor.ibd path/to/mysql-5.7/data/sakila/
Ensure that the
.ibd
file has the necessary file permissions.Import the orphan
.ibd
file. A warning is issued indicating thatInnoDB
will attempt to import the file without schema verification.Query the table to verify that the
.ibd
file was successfully restored.
Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-innodb-troubleshooting-datadict.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.