ITPub博客

首页 > 数据库 > MySQL > 【Mysql】innobackupex备份还原单个库

【Mysql】innobackupex备份还原单个库

原创 MySQL 作者:小亮520cl 时间:2016-09-12 13:48:46 0 删除 编辑
备份单个库总共有下面三种方法L:
Using the --include option
  1. $ innobackupex --include='^mydatabase[.]mytable' /path/to/backup

Using the --tables-file option
  1. $ echo "mydatabase.mytable" > /tmp/tables.txt
  2. $ innobackupex --tables-file=/tmp/tables.txt /path/to/backup

Using the --databases option 
  1. $ innobackupex --databases="mydatabase.mytable mysql" /path/to/backup

还原单个库
  1. 1 使用export还原
  2. [root@simlinux ~]#innobackupex --apply-log --export /data/databak

  3. 2 相当于还原出ibd文件了
  4. [root@simlinux ~]#ll /data/databak/se 
  5. -rw-r--r-- 1 root root 3382 9月 13 13:57 searchaccount.cfg 
  6. -rw-r--r-- 1 root root 16384 9月 13 13:57 searchaccount.exp 
  7. -rw-rw---- 1 root root 23968 9月 13 13:40 searchaccount.frm 
  8. -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博客 ” ,链接:https://blog.itpub.net/29096438/viewspace-2124829/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
毕业以后专业任职数据库工程师职位,itpub一直作为自己的笔记记录的地方,blog写的不详细,草书笔记,仅供参考!

注册时间:2013-09-12

  • 博文量
    529
  • 访问量
    1126943