源库 [root@amb01 ~]# su - mysql [mysql@amb01 ~]$ mysql -utpcc -ptpcc mysql> use tpcc1000 Database changed mysql> select count(*) from history; +----------+ | count(*) | +----------+ | 3761403 | +----------+ 1 row in set (1.16 sec) mysql> show create table history; +--------- +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +--------- +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------+ | history | CREATE TABLE `history` ( `h_c_id` int(11) DEFAULT NULL, `h_c_d_id` tinyint(4) DEFAULT NULL, `h_c_w_id` smallint(6) DEFAULT NULL, `h_d_id` tinyint(4) DEFAULT NULL, `h_w_id` smallint(6) DEFAULT NULL, `h_date` datetime DEFAULT NULL, `h_amount` decimal(6,2) DEFAULT NULL, `h_data` varchar(24) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 | +--------- +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------+ 目标库 [root@amb02 ~]# su - mysql [mysql@amb02 ~]$ mysql -utpcc -ptpcc mysql> use tpcc1000 Database changed mysql> create table `history` ( -> `h_c_id` int(11) DEFAULT NULL, -> `h_c_d_id` tinyint(4) DEFAULT NULL, -> `h_c_w_id` smallint(6) DEFAULT NULL, -> `h_d_id` tinyint(4) DEFAULT NULL, -> `h_w_id` smallint(6) DEFAULT NULL, -> `h_date` datetime DEFAULT NULL, -> `h_amount` decimal(6,2) DEFAULT NULL, -> `h_data` varchar(24) DEFAULT NULL -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8; mysql> alter table history discard tablespace; Query OK, 0 rows affected (0.23 sec) 源库 mysql> flush table history for export; Query OK, 0 rows affected (0.08 sec) [mysql@amb01 ~]$ cd /usr/local/mysql/data/tpcc1000/ [mysql@amb01 tpcc1000]$ scp history.cfg [email protected]:/usr/local/mysql/data/tpcc1000/ [mysql@amb01 tpcc1000]$ scp history.ibd [email protected]:/usr/local/mysql/data/tpcc1000/ mysql> unlock tables; Query OK, 0 rows affected (0.00 sec) 目标库 mysql> alter table history import tablespace; Query OK, 0 rows affected (8.60 sec) mysql> select count(*) from history; +----------+ | count(*) | +----------+ | 3761403 | +----------+ 1 row in set (2.27 sec)
mysql database:传输表空间
猜你喜欢
转载自blog.51cto.com/13598811/2320352
今日推荐
周排行