4.2.3 验证备份

validate您可以使用命令 检查备份的完整性 。以下是验证备份映像的示例命令以及成功验证的输出:

$ ./mysqlbackup --backup-image=/home/admin/backups/my.mbi validate
MySQL Enterprise Backup version 4.1.0 Linux-2.6.39-400.215.10.el5uek-x86_64 [2017/02/13] 
Copyright (c) 2003, 2017, Oracle and/or its affiliates. All Rights Reserved.

170214 17:46:09 MAIN    INFO: A thread created with Id '139996701841216' 
170214 17:46:09 MAIN    INFO: Starting with following command line ...
 ./mysqlbackup --backup-image=/home/admin/backups/my.mbi validate 

170214 17:46:09 MAIN    INFO: 
IMPORTANT: Please check that mysqlbackup run completes successfully.
           At the end of a successful 'validate' run mysqlbackup
           prints "mysqlbackup completed OK!".

170214 17:46:09 MAIN    INFO: Backup Image MEB version string: 4.1.0 [2017/02/13]
170214 17:46:09 MAIN    INFO: MySQL server version is '5.7.17'
170214 17:46:09 MAIN    INFO: Creating 14 buffers each of size 16777216.
170214 17:46:09 MAIN    INFO: Validate operation starts with following threads
		1 read-threads    6 process-threads
170214 17:46:09 MAIN    INFO: Validating image ... /home/admin/backups/my.mbi
170214 17:46:09 PCR1    INFO: A thread created with Id '139996431771392' 
170214 17:46:09 PCR2    INFO: A thread created with Id '139996423378688' 
170214 17:46:09 PCR3    INFO: A thread created with Id '139996414985984' 
170214 17:46:09 PCR4    INFO: A thread created with Id '139996406593280' 
170214 17:46:09 PCR5    INFO: A thread created with Id '139996263982848' 
170214 17:46:09 PCR6    INFO: A thread created with Id '139996398200576' 
170214 17:46:09 RDR1    INFO: A thread created with Id '139996440164096' 
170214 17:46:09 PCR1    INFO: Validate: [Dir]: meta
170214 17:46:10 PCR4    INFO: Validate: [Dir]: datadir/mysql
170214 17:46:10 PCR2    INFO: Validate: [Dir]: datadir/performance_schema
170214 17:46:10 PCR2    INFO: Validate: [Dir]: datadir/pets
170214 17:46:10 PCR2    INFO: Validate: [Dir]: datadir/sys
170214 17:46:10 PCR2    INFO: Validate: [Dir]: datadir/mysql
170214 17:46:10 PCR2    INFO: Validate: [Dir]: datadir/performance_schema
170214 17:46:10 PCR2    INFO: Validate: [Dir]: datadir/pets
170214 17:46:10 PCR2    INFO: Validate: [Dir]: datadir/sys
170214 17:46:10 MAIN    INFO: Total files as specified in image: 297
170214 17:46:10 MAIN    INFO: datadir/ibdata1 validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/engine_cost.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/gtid_executed.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/help_category.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/help_keyword.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/help_relation.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/help_topic.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/innodb_index_stats.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/innodb_table_stats.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/plugin.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/server_cost.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/servers.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/slave_master_info.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/slave_relay_log_info.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/slave_worker_info.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/time_zone.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/time_zone_leap_second.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/time_zone_name.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/time_zone_transition.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/mysql/time_zone_transition_type.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/pets/cats.ibd validated.
170214 17:46:10 MAIN    INFO: datadir/sys/sys_config.ibd validated.
170214 17:46:10 MAIN    INFO: Validate operation completed successfully.
170214 17:46:10 MAIN    INFO: Backup Image validation successful.
170214 17:46:10 MAIN    INFO: Source Image Path = /home/admin/backups/my.mbi

mysqlbackup completed OK!

此外,您还可以通过在不同服务器上恢复备份数据并在新数据目录上运行 MySQL 守护进程 ( mysqld ) 来验证备份是否成功。然后您可以执行SHOW 语句来验证数据库和表结构,并执行查询来验证数据库的更多详细信息。有关恢复备份的基本步骤,请参阅 第 4.2.4 节“恢复数据库” ,有关更多详细说明,请参阅第 5 章,恢复或恢复数据库

警告

Do not try to verify a backup by using the backup directory as a data directory to start a MySQL server. This will crash the server, and might also corrupt your backup. See Appendix A, Frequently Asked Questions for MySQL Enterprise Backup for details.