MySQL Enterprise Backup User's Guide (Version 4.0.3)

4.2.2 Verifying a Backup

You can check the integrity of your backup using the validate command. The following is a sample command for validating an encrypted backup image and the output for the successful validation:

$ mysqlbackup –backup-image=/meb/backups/image.mbi --decrypt --key-file=/meb/enckeyfile validate

140219 11:22:44 mysqlbackup: INFO: Validating image ... /logs/img.bi
140219 11:22:44 mysqlbackup: INFO: Validate: [Dir]: meta
140219 11:22:45 mysqlbackup: INFO: Total files as specified in image: 44
mysqlbackup: INFO: datadir/tpch/tabnorm7.ibd Validated...
mysqlbackup: INFO: datadir/tpch/tabnorm8.ibd Validated...
mysqlbackup: INFO: datadir/tpch/tabnorm9.ibd Validated...
................
140219 11:22:45 mysqlbackup: INFO: Validate operation completed successfully.
140219 11:22:45 mysqlbackup: INFO: Backup Image validation successful.
mysqlbackup: INFO: Source Image Path = /logs/img.bi
mysqlbackup completed OK!

This is a sample output for a checksum mismatch in the header:

mysqlbackup: ERROR: Checksum mismatch.
Computed checksum: ###          Checksum in image: ### mysqlbackup:    ERROR: Problem verifying checksum of initial header of backup image.
Image Path = /meb/backups/image.mbi
mysqlbackup: ERROR: Backup image validation failed.

This is a sample output for an image containing corrupted .ibd files:

mysqlbackup: ERROR: datadir/db2/bigtab1.ibd has corrupt page number : 64   page number from page header : 64
mysqlbackup: ERROR: datadir/db2/bigtab1.ibd is corrupt and has : 10 corrupt pages
mysqlbackup: ERROR: datadir/db2/t1.ibd has corrupt page number : 4   page number from     page header : 0
.......
mysqlbackup: ERROR: datadir/db2/t1.ibd is corrupt and has : 5 corrupt pages
mysqlbackup: ERROR: datadir/ibdata1 has corrupt page number : 63   page number from page header : 63
mysqlbackup: ERROR: datadir/ibdata1 has corrupt page number : 7   page number from page header : 7
..........
mysqlbackup: ERROR: datadir/ibdata1 is corrupt and has : 10 corrupt pages
mysqlbackup failed with errors!

This is a sample output for a successful validation for a compressed backup directory

mysqlbackup: INFO: /backups/backup-dir/datadir/tpch/tabnorm5.ibz Validated...
mysqlbackup: INFO: /backups/backup-dir/datadir/tpch/tabnorm6.ibz Validated...
mysqlbackup: INFO: /backups/backup-dir/datadir/tpch/tabnorm7.ibz Validated...
mysqlbackup: INFO: /backups/backup-dir/datadir/tpch/tabnorm8.ibz Validated...
mysqlbackup: INFO: /backups/backup-dir/datadir/tpch/tabnorm9.ibz Validated...
mysqlbackup: INFO: /backups/backup-dir/datadir/tpch/tabrowformat.ibz Validated...
140219 11:22:45 mysqlbackup: INFO: Validate backup directory operation completed successfully.

Furthermore, you can also verify that your backup has been successful by restoring the backup data on a different server and run the MySQL daemon (mysqld) on the new data directory. You can then execute SHOW statements to verify the database and table structures, and execute queries to verify further details of the database. See Section 4.2.3, “Restoring a Database” for the basic steps for restoring a backup, and see Chapter 5, Recovering or Restoring a Database for more detailed instructions.

Warning

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.