备份单个库总共有下面三种方法L:
Using the --include option
Using the --tables-file option
Using the --databases option
还原单个库
这种使用innobackupex备份还原单个库的方法相当麻烦
参考文档:
https://learn.percona.com/hubfs/Manuals/Percona_Xtra_Backup/Percona_XtraBackup_2.4/PerconaXtraBackup-2.4.3.pdf?t=1469054805417 ---Partial Backups 与 Restoring Individual Tables部分
Using the --include option
- $ innobackupex --include='^mydatabase[.]mytable' /path/to/backup
Using the --tables-file option
- $ echo "mydatabase.mytable" > /tmp/tables.txt
- $ innobackupex --tables-file=/tmp/tables.txt /path/to/backup
Using the --databases option
- $ innobackupex --databases="mydatabase.mytable mysql" /path/to/backup
还原单个库
1 使用export还原 [root@simlinux ~]#innobackupex --apply-log --export /data/databak
2 相当于还原出ibd文件了 [root@simlinux ~]#ll /data/databak/se -rw-r--r-- 1 root root 3382 9月 13 13:57 searchaccount.cfg -rw-r--r-- 1 root root 16384 9月 13 13:57 searchaccount.exp -rw-rw---- 1 root root 23968 9月 13 13:40 searchaccount.frm -rw-rw---- 1 root root 2097152 9月 13 13:40 searchaccount.ibd
2 相当于还原出ibd文件了 [root@simlinux ~]#ll /data/databak/se -rw-r--r-- 1 root root 3382 9月 13 13:57 searchaccount.cfg -rw-r--r-- 1 root root 16384 9月 13 13:57 searchaccount.exp -rw-rw---- 1 root root 23968 9月 13 13:40 searchaccount.frm -rw-rw---- 1 root root 2097152 9月 13 13:40 searchaccount.ibd
3 拷贝ibd等文件,然后discard,import 即可,每张表都需要新建,discard再import
这种使用innobackupex备份还原单个库的方法相当麻烦
参考文档:
https://learn.percona.com/hubfs/Manuals/Percona_Xtra_Backup/Percona_XtraBackup_2.4/PerconaXtraBackup-2.4.3.pdf?t=1469054805417 ---Partial Backups 与 Restoring Individual Tables部分
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29096438/viewspace-2124829/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29096438/viewspace-2124829/