mysql5.6新特性--transportable tablespace

背景

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;

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值