# Restoring an incremental backup

**URL:** <https://forums.percona.com/t/restoring-an-incremental-backup/4224>\
**Category:** Percona XtraBackup\
**Created:** [May 18, 2015, 5:16am UTC](https://forums.percona.com/t/restoring-an-incremental-backup/4224 "2015-05-18T05:16:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![George](https://avatars.discourse-cdn.com/v4/letter/g/71e660/32.png) [@George](https://forums.percona.com/u/George)\
**Post date:** [May 18, 2015, 5:16am UTC](https://forums.percona.com/t/restoring-an-incremental-backup/4224/1 "2015-05-18T05:16:36Z")

</div>

Hello all,

As I am new to Xtrabackup I am facing some difficulties on how to restore an incremental backup. In more details:

Step 1. Take a fll backup

Step 2. Create an incremental backup  
[COLOR=#B22222] #[COLOR=#B22222]innobackupex --incremental --user= --password= /home/mysql\_test/MYSQL\_BACKUPS/ --incremental- basedir=/home/mysql\_test/MYSQL\_BACKUPS/2015-05-14\_15-55-09\_FULL\_BACKUP  
   
where[/B]2015-05-14\_15-55-09\_FULL\_BACKUP → latest full backup  
[B]  
The above will create another dir under [B][/B]/home/mysql\_test/MYSQL\_BACKUPS/ with execution date e.g 2015-05-15\_15-55-09\_1st\_INCREMENTAL\_BACKUP

Step 3. Create another incremental backup:  
[COLOR=#B22222] #[B][COLOR=#B22222]innobackupex --incremental --user= --password= /home/mysql\_test/MYSQL\_BACKUPS/ --incremental- basedir=/home/mysql\_test/MYSQL\_BACKUPS/2015-05-15\_15-55-09\_1st\_INCREMENTAL\_BACKUP

[/B]and this will create the next incremental backup: e.g 2015-05-16\_15-55-09\_2nd\_INCREMENTAL\_BACKUP

So up to now we have one full and 2 incremental backups under our backup directory:

/home/mysql\_test/MYSQL\_BACKUPS/   
[B][I]- 2015-05-14\_15-55-09\_FULL\_BACKUP

- 2015-05-15\_15-55-09\_1st\_INCREMENTAL\_BACKUP[/I][/B]  
-2015-05-16\_15-55-09\_2nd\_INCREMENTAL\_BACKUP

Here is where I face my dificulties and need your help, how to restore one of my 2 incremental backups…

Based on [B][U][url][https://www.percona.com/doc/percona-xtrabackup/2.2/innobackupex/incremental\_backups\_innobackupex.html[/url][/U][/B]](https://www.percona.com/doc/percona-xtrabackup/2.2/innobackupex/incremental_backups_innobackupex.html%5B/url%5D%5B/U%5D%5B/B%5D) before restoring an incremental backup we need to prepare it where I do:

Step 4. Prepare the incremental backup:  
 [COLOR=#B22222] [COLOR=#B22222]#[COLOR=#B22222]innobackupex --apply-log --redo-only /home/mysql\_test/MYSQL\_BACKUPS/[COLOR=#FF0000]\<???????\>

Question 1. Which incremental I should use for this command, should I use this command for all the incrementals created above (1st… and 2nd…)

Question 2. After preparing my incremental backups (if this is what I have to do on Step 4) how do I restore one incremental backup e.g the latest one 2015-05-16\_15-55-09\_2nd\_INCREMENTAL\_BACKUP

Thank you all and looking forward for your suggestions  
George

---

<div class="post-metadata">

**Author:** ![scott.nemes](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/scott.nemes/32/5_2.png) [@scott.nemes](https://forums.percona.com/u/scott.nemes)\
**Post date:** [May 18, 2015, 2:27pm UTC](https://forums.percona.com/t/restoring-an-incremental-backup/4224/2 "2015-05-18T14:27:59Z")

</div>

Hi George;

Percona has a good guide for this which should get you on the right track:  
[url][Percona XtraBackup](https://www.percona.com/doc/percona-xtrabackup/2.2/innobackupex/incremental_backups_innobackupex.html%5B/url%5D)

Basically you do --apply-log on the base with --redo-only, then do the same on the 1st incremental, then do the same on the second incremental except on the last one you can leave off the --redo-only part.

After the prepare step, the full backup in your base directory will have all the incrementals applied to it, so you would restore that (the full backup from the base directory).

-Scott

---

<div class="post-metadata">

**Author:** ![jrivera](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/jrivera/32/13_2.png) [@jrivera](https://forums.percona.com/u/jrivera)\
**Post date:** [May 18, 2015, 3:40pm UTC](https://forums.percona.com/t/restoring-an-incremental-backup/4224/3 "2015-05-18T15:40:56Z")

</div>

So, let me try to answer you here.

I would assume you now have the following directories  
Full: /home/mysql\_test/MYSQL\_BACKUPS/2015-05-14\_15-55-09\_FULL\_BACKUP

Incremental Dir 1: 2015-05-15\_15-55-09\_1st\_INCREMENTAL\_BACKUP  
Incremental Dir 2: 2015-05-16\_15-55-09\_2nd\_INCREMENTAL\_BACKUP

To restore Incremental Dir 1 backup, you need to prepare the full + incremental\_dir\_1 with the following:

innobackupex --apply-log --redo-only /path/to/fullbackup

then

innobackupex --apply-log /path/to/fullbackup --incremental-dir=/path/to/incremental-dir-1

At this moment, /path/to/fullbackup contains the data up to the moment of the first incremental backup. Note that the full data will always be in the directory of the base backup, as we are appending the increments to it.

---

<div class="post-metadata">

**Author:** ![George](https://avatars.discourse-cdn.com/v4/letter/g/71e660/32.png) [@George](https://forums.percona.com/u/George)\
**Post date:** [May 19, 2015, 5:05am UTC](https://forums.percona.com/t/restoring-an-incremental-backup/4224/4 "2015-05-19T05:05:57Z")

</div>

Thank you for your replies. Problem solved usng the below link which describes clearly all steps.  
[url][Xtrabackup in a nutshell | FromDual](http://fromdual.com/xtrabackup_in_a_nutshell#fb_restore%5B/url%5D)
