您的位置:首页 > 数据库 > MySQL

mysql5.6新特性--transportable tablespace

2015-11-28 14:41 471 查看

背景

1、5.6之前所有table的元数据,表空间id,都在system tablespace,导数据、恢复数据比较麻烦。

作用

1、导数据、恢复数据、数据迁移(比如考到ssd等性能好、容量高的机器)

使用条件以及约束

1、file_per_table开启

2、import table的page_size大小一样

3、不支持分区表导出

4、不支持有外键约束的其中一个表导出,除非关闭foreign_key_checks,或者两个约束表一起导出

5、ALTER TABLE … IMPORT TABLESPACE does not enforce foreign key constraints on imported data. If there are foreign key constraints between tables, all tables should be exported at the same (logical) point in time.

6、In MySQL 5.6 or later, importing a tablespace file from another server works if both servers have GA (General Availability) status and their versions are within the same series. Otherwise, the file must have been created on the server into which it is imported.

7、In replication scenarios, innodb_file_per_table must be set to ON on both the master and slave.

操作

1、dest:ALTER TABLE t DISCARD TABLESPACE;

2、source:FLUSH TABLES t FOR EXPORT;会创建一个.cfg文件来校验schema

3、copy两个文件

4、source:unlock tables

5、dest:ALTER TABLE t IMPORT TABLESPACE;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: