现有需求:需要备份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. EasyUI 的Tab 标签添加右键菜单

    样式: 主要提供右键功能代码. (只需要提供你需要的js和css就行了) <!doctype html> <html> <head> <base href=& ...

  2. SAP采购订单历史明细报表源代码(自己收藏)

    SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF } ...

  3. linux笔记:linux服务管理

    linux服务的分类: 启动和自启动: 查询已经安装的服务: RPM包的默认安装路径: 独立服务的启动: 独立服务的自启动: 基于xinetd的服务的管理: xinetd服务的自启动: 源码包安装服务 ...

  4. Map的五种遍历方法

    package com.jackey.topic; import java.util.ArrayList;import java.util.HashMap;import java.util.Itera ...

  5. WordPress登陆页和后台面空白解决方法

    真没想到我居然也会碰到这么蛋疼的事情,有一天我登陆博客,输入账号密码之后登陆没有反应,之后我就试着用首页前台登陆(因为这个模板前台带登陆功能),之后成功登陆进入后台更新文章.我想算了.这小毛病就丢那吧 ...

  6. Android 三级联动选择城市+后台服务加载数据库

    技术渣,大家将就着看 首先我们需要一个xml数据保存到数据库,这里我从QQ下面找到一个loclist.xml文件 <CountryRegion Name="中国" Code= ...

  7. 20145236 GDB调试汇编堆栈过程分析

    GDB调试汇编堆栈过程分析 首先需要输入sudo apt-get install libc6-dev-i386安装一个库才能产生汇编代码,然后输入gcc - g example.c -o exampl ...

  8. Spring Bean

    一.Spring的几大模块:Data access & Integration.Transcation.Instrumentation.Core Spring Container.Testin ...

  9. HTML <div> 标签

    定义和用法: <div> 可定义文档中的分区或节(division/section). <div> 标签可以把文档分割为独立的.不同的部分.它可以用作严格的组织工具,并且不使用 ...

  10. Rank() 、DENSE_RANK()、NTILE(n)的用法-转

    Rank() over()/DENSE_RANK()  over()的用法 1.Rank() over()/DENSE_RANK()  over() 这两个函数与ROW_NUMBER()函数类似,因为 ...