innobackupex per table

时间:2022-12-15 14:29:01

#innobackupex export table
innobackupex --defaults-file=/etc/my.cnf --sock=/data/3306/mysql_3306.sock --user=root \
--password=oldboy123 --include='tpcc.item' --slave-info --safe-slave-backup /data/backup

#innobackupex --apply-log and export cfg and ibd
innobackupex --apply-log --export /data/backup/2018-04-15_04-51-46

#create table item
CREATE TABLE `item` (
`i_id` int(11) NOT NULL,
`i_im_id` int(11) DEFAULT NULL,
`i_name` varchar(24) DEFAULT NULL,
`i_price` decimal(5,2) DEFAULT NULL,
`i_data` varchar(50) DEFAULT NULL,
PRIMARY KEY (`i_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

# discard tablespace
alter table item discard tablespace;

#cp cfg and ibd
cp /data/backup/2018-04-15_04-51-46/tpcc/{item.cfg,item.ibd} /data/3306/data/d3307

#chowm mysql
chown mysql:mysql item.*

#import tablespace
alter table item import tablespace;