Documentation Home
MySQL Enterprise Backup 9.3 User's Guide
Related Documentation Download this Manual
PDF (US Ltr) - 1.3Mb
PDF (A4) - 1.3Mb


5.1.7 Advanced: Preparing and Restoring a Directory Backup

A directory backup, just like a single-file backup, can beprepared and restored using thecopy-back-and-apply-log command as explained at the beginning ofSection 5.1, “Performing a Restore Operation”.

Example 5.10 Restoring a Backup Directory usingcopy-back-and-apply-log

mysqlbackup --defaults-file=/usr/local/mysql/my.cnf \  --backup-dir=/export/backups/full \copy-back-and-apply-log


However, two alternatives exist for directory backups:

  • Perform theapply log operation on theraw backup right after the backup, or anytime before restore, using theapply-log command. You can run this step on the same database server where you did the backup, or transfer the raw backup files to a different system first, to limit the CPU and storage overhead on the database server. Here are some examples of doing that, on different kinds of directory backups:

    Example 5.11 Applying the Log to a Backup

    This example runsmysqlbackup to roll forward the data files so that the data is ready to be restored:

    mysqlbackup --backup-dir=/export/backups/2011-06-21__8-36-58 apply-log

    That command creates InnoDB log files (ib_logfile*) within the backup directory and applies log records to the InnoDB data files (ibdata* and*.ibd). For a compressed backup, there is no need to add the--uncompress option.


  • For backups that are non-incremental, you can combine the initial backup and theapply-log steps using thebackup-and-apply-log command.

After the backup has been prepared, you can now restore it using thecopy-back command:

mysqlbackup --defaults-file=/usr/local/mysql/my.cnf \  --backup-dir=/export/backups/full \    copy-back