MySQL Enterprise Backup User's Guide (Version 4.0.3)
A directory backup, just like a single-file backup, can be
prepared and
restored using the
copy-back-and-apply-log
command as
explained at the beginning of Section 5.1, “Performing a Restore Operation”.
Example 5.14 Restoring a Backup Directory using copy-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 the
apply log
operation on the
raw backup right
after the backup, or anytime before restore, using the
apply-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.15 Applying the Log to a Backup
This example runs mysqlbackup 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
).
Example 5.16 Applying the Log to a Compressed Backup
If the backup is compressed, as in
Section 4.3.4, “Making a Compressed Backup”, specify the
--uncompress
option to
mysqlbackup when applying the log to
the backup:
mysqlbackup --backup-dir=/export/backups/compressed --uncompress apply-log
Since the
apply log
operation does not modify any of the original
files in the backup, nothing is lost if the operation
fails for some reason (for example, insufficient disk
space). After fixing the problem, you can safely retry
apply-log
and by specifying
the --force
option, which
allows the data and log files created by the failed
apply log
operation to be overwritten.
For backups that are non-incremental, you can combine the
initial backup and the
apply-log
steps using the
backup-and-apply-log
command.
After the backup has been prepared, you can now restore it using
the copy-back
command:
mysqlbackup --defaults-file=/usr/local/mysql/my.cnf \ --backup-dir=/export/backups/full \ copy-back