zoukankan      html  css  js  c++  java
  • [MySQL 5.6] Innodb新特性之export/import 表文件

    [MySQL 5.6] Innodb新特性之export/import 表文件
    从库也需要拷贝文件:binlog只记录 discard,import的操作。否则从库复制报错


    show create table imp_sbtestG;
    *************************** 1. row ***************************
    Table: imp_sbtest
    Create Table: CREATE TABLE `imp_sbtest` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `k` int(11) NOT NULL DEFAULT '0',
    `c` char(120) NOT NULL DEFAULT '',
    `pad` char(60) NOT NULL DEFAULT '',
    `fr` varchar(30) DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `k_1` (`k`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1
    1 row in set (0.01 sec)

    mysql> alter table imp_sbtest discard tablespace;
    Query OK, 0 rows affected (0.01 sec)
    mysql> select * from imp_sbtest;
    ERROR 1030 (HY000): Got error -1 from storage engine

    #imp_sbtest.ibd 文件会被删除
    -rw-rw---- 1 mysql mysql 8658 4月 18 13:09 imp_sbtest.frm


    (root@localhost) [test]> flush table sbtest for export; #sbtest表可读不可写 #最后执行unlock tables;
    Query OK, 0 rows affected (0.00 sec)

    #多出来cfg文件
    -rw-rw---- 1 mysql mysql 613 4月 18 13:12 sbtest.cfg
    -rw-rw---- 1 mysql mysql 8658 4月 18 11:52 sbtest.frm
    -rw-rw---- 1 mysql mysql 114688 4月 18 11:52 sbtest.ibd

    #拷贝cfg文件和ibd文件到另一个库:
    root@pts/2 # cp -p sbtest.cfg ../mao/imp_sbtest.cfg
    root@pts/2 # cp -p sbtest.ibd ../mao/imp_sbtest.ibd

    (root@localhost) [test]> unlock tables; #解锁sbtest 解锁后sbtest.cfg 消失

    -rw-rw---- 1 mysql mysql 613 4月 18 13:12 imp_sbtest.cfg
    -rw-rw---- 1 mysql mysql 8658 4月 18 13:09 imp_sbtest.frm
    -rw-rw---- 1 mysql mysql 114688 4月 18 11:52 imp_sbtest.ibd
    -rw-rw---- 1 mysql mysql 613 4月 18 13:12 sbtest.cfg
    -rw-rw---- 1 mysql mysql 8658 4月 18 11:52 sbtest.frm
    -rw-rw---- 1 mysql mysql 114688 4月 18 11:52 sbtest.ibd


    mysql> alter table imp_sbtest import tablespace;

    参考:

    https://www.cnblogs.com/xuanzhi201111/p/4158223.html
    https://blog.csdn.net/ashic/article/details/77478659

  • 相关阅读:
    php开发环境
    Kofax Transformation Modules
    htmlagilitypack
    OpenOffice 和 LibreOffice
    php manual
    using the web deploy
    *.deploy.cmd
    Volumn Shadow Copy
    Web Deployment Tool 服务器端
    趣味编程丨如何用C语言区分旅客的国籍?教你一招,包你学会!
  • 原文地址:https://www.cnblogs.com/mao3714/p/8875374.html
Copyright © 2011-2022 走看看