ALTER TABLE tbl_name DISCARD TABLESPACE;
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.
The ALTER TABLE ... IMPORT TABLESPACE feature does not enforce foreign key constraints on imported data.
参考:
posted on 2014-05-29 01:53 Still water run deep 阅读(952) 评论(0) 收藏 举报
浙公网安备 33010602011771号