For an InnoDB table that is created with its own tablespace in an .ibd file, that file can be discarded and imported. To discard the .ibd file, use this statement:
ALTER TABLE tbl_name DISCARD TABLESPACE;
This deletes the current .ibd file, so be sure that you have a backup first. Attempting to access the table while the tablespace file is discarded results in an error.
To import the backup .ibd file back into the table, copy it into the database directory, and then issue this statement:
ALTER TABLE tbl_name IMPORT TABLESPACE;
The tablespace file must have been created on the server into which it is imported later.
Note
The ALTER TABLE ... IMPORT TABLESPACE feature does not enforce foreign key constraints on imported data.
欢迎光临 深圳全飞鸿 (http://www.nagomes.com/disc/) | Powered by Discuz! X3.2 |