4.2.3 验证备份

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

$ mysqlbackup --backup-image=/home/meb/mysql/backups/testback3.mbi validate
MySQL Enterprise Backup  Ver 8.0.31-commercial for Linux on x86_64 (MySQL Enterprise - Commercial)
Copyright (c) 2003, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Starting with following command line ...
./bin/mysqlbackup
--backup-image=/home/meb/mysql/backups/testback3.mbi
validate

IMPORTANT: Please check that mysqlbackup run completes successfully.
           At the end of a successful 'validate' run mysqlbackup
           prints "mysqlbackup completed OK!".

220913 14:53:38 MAIN     INFO: Backup Image MEB version string: 8.0.31
220913 14:53:38 MAIN     INFO: MySQL server version is '8.0.31'
220913 14:53:38 MAIN     INFO: The backup image has no keyring.
220913 14:53:38 MAIN     INFO: Creating 14 buffers each of size 16777216.
220913 14:53:38 MAIN     INFO: Validate operation starts with following threads
                               1 read-threads    6 process-threads
220913 14:53:38 MAIN     INFO: Validating image ... /home/meb/mysql/backups/testback3.mbi
220913 14:53:38 PCR6     INFO: Validate: [Dir]: meta
220913 14:53:39 PCR6     INFO: Validate: [Dir]: datadir/Test
220913 14:53:39 PCR6     INFO: Validate: [Dir]: datadir/mysql
220913 14:53:39 PCR6     INFO: Validate: [Dir]: datadir/performance_schema
220913 14:53:39 PCR3     INFO: Validate: [Dir]: datadir/sys
220913 14:53:39 MAIN     INFO: datadir/mysql.ibd validated.
220913 14:53:39 MAIN     INFO: datadir/undo_002 validated.
220913 14:53:39 MAIN     INFO: datadir/sys/sys_config.ibd validated.
220913 14:53:39 MAIN     INFO: datadir/ibdata1 validated.
220913 14:53:39 MAIN     INFO: datadir/undo_001 validated.
220913 14:53:39 MAIN     INFO: datadir/Test/test1.ibd validated.
220913 14:53:39 MAIN     INFO: datadir/mysql/backup_history.ibd validated.
220913 14:53:39 MAIN     INFO: datadir/mysql/backup_progress.ibd validated.
220913 14:53:39 MAIN     INFO: Validate operation completed successfully.
220913 14:53:39 MAIN     INFO: Backup Image validation successful.
220913 14:53:39 MAIN     INFO: Source Image Path = /home/meb/mysql/backups/testback3.mbi

mysqlbackup completed OK!

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

警告

不要尝试通过将 备份目录 用作启动 MySQL 服务器的数据目录来验证备份。这将使服务器崩溃,并且还可能损坏您的备份。有关详细信息,请参阅 附录 A,MySQL Enterprise Backup 的常见问题解答