mysqlperconamysql-backup

Percona - copy-back option in xtrabackup for restoring partial backups


I use copy-back option in xtrabackup while doing a full data restore. For copy-back option to execute successfully, the data directory should be empty.

Why cant I use the same copy-back option while doing a restore of partial backups instead of manually copying the 'tablename'.* files to the data directory? May I know the limitations of copy-back option and why cant I use it for partial backups as copy-backup option copies the files from the backup directory to the data directory only.


Solution

  • Seems like there is an option --force-non-empty-directories option which allows to use copy-back option for partial backups. There are few things to do before.

    Note: We should NOT prepare the backup. Because this create ib_logfiles and restoring these files to the server makes it corrupted.

    1. If we want to restore a particular database while having the remaining data in the server, we need to remove the database directory, ibdata1,xtrabackup_info file(because the data cannot be overwritten with --force-non-empty-directories option).
    2. Then we can run the copy-back along with force-non-empty-directories option.
    3. Restart the server.
    4. The database is restored till the point of backup.