现有需求:需要备份MySQL5.6环境下的部分表到MySQL5.7环境下并进行恢复

通过xtrabackup 实现部分备份有三种方式:

参考链接:http://blog.csdn.net/zhu19774279/article/details/49681767

我这里测试了两种方法:

way1

/usr/bin/innobackupex --defaults-file=/etc/mysql/3306.cnf /data0/sql  --include='test.t1|mysql.*|performance_schema.*' --user=root --socket=/tmp/mysql_3306.sock

way2

/usr/bin/innobackupex --defaults-file=/etc/mysql/3306.cnf /data0/sql  --databases='test.t1 mysql performance_schema' --user=root --socket=/tmp/mysql_3306.sock

但在应用日志时都会出现同样的问题,报备份单个表所在的库的其他表的表空间不存在

[root@mysql-bcc01 sql]# innobackupex --apply-log --export --08_17--
:: innobackupex: Starting the apply-log operation IMPORTANT: Please check that the apply-log run completes successfully.
At the end of a successful apply-log run innobackupex
prints "completed OK!". innobackupex version 2.4. based on MySQL server 5.7. Linux (x86_64) (revision id: df58cf2)
xtrabackup: auto-enabling --innodb-file-per-table due to the --export option
xtrabackup: cd to /data0/sql/--08_17--
xtrabackup: This target seems to be not prepared yet.
InnoDB: Number of pools:
xtrabackup: xtrabackup_logfile detected: size=, start_lsn=()
xtrabackup: using the following InnoDB configuration for recovery:
xtrabackup: innodb_data_home_dir = .
xtrabackup: innodb_data_file_path = ibdata1:512M:autoextend
xtrabackup: innodb_log_group_home_dir = .
xtrabackup: innodb_log_files_in_group =
xtrabackup: innodb_log_file_size =
xtrabackup: using the following InnoDB configuration for recovery:
xtrabackup: innodb_data_home_dir = .
xtrabackup: innodb_data_file_path = ibdata1:512M:autoextend
xtrabackup: innodb_log_group_home_dir = .
xtrabackup: innodb_log_files_in_group =
xtrabackup: innodb_log_file_size =
xtrabackup: Starting InnoDB instance for recovery.
xtrabackup: Using bytes for buffer pool (set by --use-memory parameter)
InnoDB: PUNCH HOLE support not available
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Uses event mutexes
InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
InnoDB: Compressed tables use zlib 1.2.
InnoDB: Number of pools:
InnoDB: Using CPU crc32 instructions
InnoDB: Initializing buffer pool, total size = 100M, instances = , chunk size = 100M
InnoDB: Completed initialization of buffer pool
InnoDB: page_cleaner coordinator priority: -
InnoDB: Highest supported file format is Barracuda.
InnoDB: The log sequence number in the system tablespace does not match the log sequence number in the ib_logfiles!
InnoDB: Database was not shutdown normally!
InnoDB: Starting crash recovery.
InnoDB: Doing recovery: scanned up to log sequence number (%)
InnoDB: xtrabackup: Last MySQL binlog file position , file name mysql-bin.
InnoDB: Creating shared tablespace for temporary tables
InnoDB: Setting file './ibtmp1' size to MB. Physically writing the file full; Please wait ...
InnoDB: File './ibtmp1' size is now MB.
InnoDB: redo rollback segment(s) found. redo rollback segment(s) are active.
InnoDB: non-redo rollback segment(s) are active.
InnoDB: 5.7. started; log sequence number
xtrabackup: export option is specified.
xtrabackup: export metadata of table 'test/t1' to file `./test/t1.exp` ( indexes)
xtrabackup: name=PRIMARY, id.low=, page=
xtrabackup: export metadata of table 'mysql/slave_relay_log_info' to file `./mysql/slave_relay_log_info.exp` ( indexes)
xtrabackup: name=PRIMARY, id.low=, page=
xtrabackup: export metadata of table 'mysql/innodb_index_stats' to file `./mysql/innodb_index_stats.exp` ( indexes)
xtrabackup: name=PRIMARY, id.low=, page=
xtrabackup: export metadata of table 'mysql/slave_worker_info' to file `./mysql/slave_worker_info.exp` ( indexes)
xtrabackup: name=PRIMARY, id.low=, page=
xtrabackup: export metadata of table 'mysql/innodb_table_stats' to file `./mysql/innodb_table_stats.exp` ( indexes)
xtrabackup: name=PRIMARY, id.low=, page=
xtrabackup: export metadata of table 'mysql/slave_master_info' to file `./mysql/slave_master_info.exp` ( indexes)
xtrabackup: name=PRIMARY, id.low=, page=
InnoDB: xtrabackup: Last MySQL binlog file position , file name mysql-bin. xtrabackup: starting shutdown with innodb_fast_shutdown =
InnoDB: FTS optimize thread exiting.
InnoDB: Starting shutdown...
InnoDB: Failed to find tablespace for table `test`.`t2` in the cache. Attempting to load the tablespace with space id
InnoDB: Operating system error number in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: Cannot open datafile for read-only: './test/t2.ibd' OS error:
InnoDB: Operating system error number in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: Could not find a valid tablespace file for `test/t2`. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
InnoDB: Shutdown completed; log sequence number
InnoDB: Number of pools:
xtrabackup: using the following InnoDB configuration for recovery:
xtrabackup: innodb_data_home_dir = .
xtrabackup: innodb_data_file_path = ibdata1:512M:autoextend
xtrabackup: innodb_log_group_home_dir = .
xtrabackup: innodb_log_files_in_group =
xtrabackup: innodb_log_file_size =
InnoDB: PUNCH HOLE support not available
InnoDB: Mutexes and rw_locks use GCC atomic builtins
InnoDB: Uses event mutexes
InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
InnoDB: Compressed tables use zlib 1.2.
InnoDB: Number of pools:
InnoDB: Using CPU crc32 instructions
InnoDB: Initializing buffer pool, total size = 100M, instances = , chunk size = 100M
InnoDB: Completed initialization of buffer pool
InnoDB: page_cleaner coordinator priority: -
InnoDB: Setting log file ./ib_logfile101 size to MB
InnoDB: Progress in MB: InnoDB: Setting log file ./ib_logfile1 size to MB
InnoDB: Progress in MB: InnoDB: Setting log file ./ib_logfile2 size to MB
InnoDB: Progress in MB: InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
InnoDB: New log files created, LSN=
InnoDB: Highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn
InnoDB: Doing recovery: scanned up to log sequence number (%)
InnoDB: Doing recovery: scanned up to log sequence number (%)
InnoDB: Database was not shutdown normally!
InnoDB: Starting crash recovery.
InnoDB: xtrabackup: Last MySQL binlog file position , file name mysql-bin.
InnoDB: Removed temporary tablespace data file: "ibtmp1"
InnoDB: Creating shared tablespace for temporary tables
InnoDB: Setting file './ibtmp1' size to MB. Physically writing the file full; Please wait ...
InnoDB: File './ibtmp1' size is now MB.
InnoDB: redo rollback segment(s) found. redo rollback segment(s) are active.
InnoDB: non-redo rollback segment(s) are active.
InnoDB: 5.7. started; log sequence number
InnoDB: Failed to find tablespace for table `test`.`t2` in the cache. Attempting to load the tablespace with space id
InnoDB: Operating system error number in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: Cannot open datafile for read-only: './test/t2.ibd' OS error:
InnoDB: Operating system error number in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: Could not find a valid tablespace file for `test/t2`. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
xtrabackup: starting shutdown with innodb_fast_shutdown =
InnoDB: FTS optimize thread exiting.
InnoDB: Starting shutdown...
InnoDB: Shutdown completed; log sequence number
:: completed OK!

查找结果是这是一个bug:https://bugs.launchpad.net/percona-xtrabackup/+bug/1532878

直接通过cp备份集到5.7环境下恢复并升级后

[root@mysql-bcc02 mysql]# mysql_upgrade --user=root --socket=/tmp/mysql_6666.sock

重启成功,但错误日志中报和上面相同的错误,既没有复制的表的表空间不存在

这又是一个bug:https://bugs.mysql.com/bug.php?id=82060

恢复部分备份

参考文献:https://www.percona.com/doc/percona-xtrabackup/2.2/innobackupex/restoring_individual_tables_ibk.html

MySQL5.6下使用xtrabackup部分备份恢复到MySQL5.7的更多相关文章

  1. MySQL for OPS 06:备份恢复

    写在前面的话 人在河边走,湿鞋是早晚是事情,操作服务器,数据库也一样.谁也不知道自己哪一天控制不住自己就手贱.这时候有两个东西能救我们,一是备份,二是 bin log,bin log 前面讲了,但是 ...

  2. mongodb数据库备份恢复-windows系统

    备份语法: mongodump命令脚本语法如下: >mongodump -h dbhost -d dbname -o dbdirectory -h: MongDB所在服务器地址,例如:127.0 ...

  3. Xtrabackup 物理备份

    目录 Xtrabackup 安装 Xtrabackup 备份介绍 Xtrabackup全量备份 准备备份目录 全量备份 查看全量备份内容 Xtrabackup 全量备份恢复数据 删除所有数据库 停止数 ...

  4. xtrabackup原理,整库,单表,部分备份恢复

    物理备份xtrabackup原理 Percona XtraBackup(简称PXB)是 Percona 公司开发的一个用于 MySQL 数据库物理热备的备份工具,支持 MySQl(Oracle).Pe ...

  5. xtrabackup增量备份MySQL-5.7操作说明

    下载工具 本方法利用xtrabackup二进制包,版本是2.4.26 # 从官网下载二进制包:wget https://downloads.percona.com/downloads/Percona- ...

  6. Xtrabackup原理及使用innobackupex进行MySQL数据库备份恢复

    Xtrabackup是由percona提供的mysql数据库备份工具,据官方介绍,这也是世界上惟一一款开源的能够对innodb和xtradb数据库进行热备的工具. Xtrabackup中主要包含两个工 ...

  7. Xtrabackup之innobackupex备份恢复详解(转)

    add by zhj:对于Xtrabackup2.2来说,已经解决了本文结尾提到的那个bug,当使用--copy-back时,同时加--force-non-empty-directories 即可.这 ...

  8. mysql 开发进阶篇系列 47 物理备份与恢复(xtrabackup 的完全备份恢复,恢复后重启失败总结)

    一. 完全备份恢复说明 xtrabackup二进制文件有一个xtrabackup --copy-back选项,它将备份复制到服务器的datadir目录下.下面是通过 --target-dir 指定完全 ...

  9. xtrabackup 对pxc节点进行备份恢复

    xtrabackup 对pxc节点进行备份恢复 全量备份一个节点的数据,当节点挂掉时,使用备份恢复到最近状态,再启动节点加入集群. 备份 xtrabackup 命令小解释: --defaults-fi ...

随机推荐

  1. Java中的JDK动态代理

    所谓代理,其实就是相当于一个中间人,当客户端需要服务端的服务时,不是客户直接去找服务,而是客户先去找代理,告诉代理需要什么服务,然后代理再去服务端找服务,最后将结果返回给客户. 在日常生活中,就拿买火 ...

  2. SQL SERVER与SSIS 数据类型对应关系

  3. 搜集资料&安装环境

    开始入坑DSP,芯片是TI的TMS320C6678,硬件平台为TI官方的TMS320C6678L开发板. 官方给的资料有很多,各种用户手册.软件支持包,眼花缭乱.先尝试把开发环境搭起来,跑个Hello ...

  4. python编程(一)汉诺塔

    题目描述 编写move(n, a, b, c)函数,它接收参数n,表示3个柱子A.B.C中第1个柱子A的盘子数量,然后打印出把所有盘子从A借助B移动到C的方法. 例: move(3, 'A', 'B' ...

  5. oracle笔记一

    一.Oracle简介 1.Oracle属于关系型数据库,是一款可以在Client/Server模式下运行的RDBMS产品.2009年,Oracle公司收购SUN. 2.Oracle是对象关系型数据库管 ...

  6. nodejs学习笔记之events

    events 模块只提供了一个对象: events.EventEmitter. EventEmitter 的核心就是事件触发与事件监听器功能的封装. 可以通过require("events& ...

  7. SPSS数据分析—多维偏好分析(MPA)

    之前的主成分分析和因子分析中,收集的变量数据都是连续型数值,但有时会碰到分类数据的情况,我们知道最优尺度变换可以对分类变量进行量化处理,如果将这一方法和主成分分析相结合,就称为了基于最优尺度变换的主成 ...

  8. DDOS分布式拒绝服务

    DDOS(分布式拒绝服务)概念 DDOS称为分布式拒绝服务,DDOS本是利用合理的请求伪造资源过载,导致服务不可用.比如一个停车场有100个停车位,当100个停车位都停满后,再有车想要进来.就必须要等 ...

  9. 重温Javascript第一章

    一.script标签 script标签有6个属性,其中一个废弃,五个可选. 按照传统的写法,<script>的标签都是放在<head>元素中,但是在<head>中包 ...

  10. gulp入门教程

    第1步:安装Node 首先,最基本也最重要的是,我们需要搭建node环境.访问 nodejs.org,下载完成后直接运行程序,就一切准备就绪.npm会随着安装包一起安装,稍后会用到它. 为了确保Nod ...