patternsqlMinor
Restoring a database using backups that cover the same time periods multiple times
Viewed 0 times
samethebackupsperiodstimerestoringdatabasethatusingmultiple
Problem
everyone
I have some questions about a database restore sequence. Suppose I have the following backup events:
Now, suppose I want to restore the database back to the end of log backup 4, what I would normally do is to restore
I skip
The question is: Aren't we applying the changes contained in the backups twice if we were to include the differential backup in the sequence?
Is there any difference between these two approaches, either in terms of possible data loss or performance?
The overall question is then: Is it CONCEPTUALLY okay to restore a database using all kinds of backups (Full, Differential, Log, Files/Filegroups) as long as they are restored in order from the earliest to the latest, and the backups span the entire time period required, even though they might containing overlapping information about changes to the database?
Thanks
I have some questions about a database restore sequence. Suppose I have the following backup events:
t00 Database creation
t01 FULL database backup 1
t02 Database DIFFERENTIAL backup 1
t03 Log backup 1
t04 log backup 2
t05 Log backup 3
t06 log backup 4
t07 log backup 5
t12 Full Database Backup 2
t13 Log backup 9
t14 Log backup 10
t15 Disaster Hits!Now, suppose I want to restore the database back to the end of log backup 4, what I would normally do is to restore
Full database backup 1,
Log backup 1
Log backup 2
Log backup 3
Log backup 4I skip
Database DIFFERENTIAL backup 1 because I believe it is redundant. But I have seen many articles that would include Database DIFFERENTIAL backup 1 in the sequence. The question is: Aren't we applying the changes contained in the backups twice if we were to include the differential backup in the sequence?
Is there any difference between these two approaches, either in terms of possible data loss or performance?
The overall question is then: Is it CONCEPTUALLY okay to restore a database using all kinds of backups (Full, Differential, Log, Files/Filegroups) as long as they are restored in order from the earliest to the latest, and the backups span the entire time period required, even though they might containing overlapping information about changes to the database?
Thanks
Solution
DIFFERENTIAL backups are there for one and only one purpose: to speed up restore by allowing you to skip one or more LOG backups. Namely, all LOG backups taken between the last FULL backup and the DIFFERENTIAL in question.
Since, in your example, you have no LOG backups between the FULL and DIFFERENTIAL, then there is no LOG backup to skip so there is no restore speed to gain. Attempting to restore the DIFFERENTIAL is a waste of time.
If, say, you'd modify the sequence like this:
then it would be a benefit by allowing you to skip the restore of LOG backups 1-4.
Since, in your example, you have no LOG backups between the FULL and DIFFERENTIAL, then there is no LOG backup to skip so there is no restore speed to gain. Attempting to restore the DIFFERENTIAL is a waste of time.
If, say, you'd modify the sequence like this:
t01 FULL database backup 1
t02 Log backup 1
t03 log backup 2
t04 Log backup 3
t05 log backup 4
t06 Database DIFFERENTIAL backup 1
t07 log backup 5then it would be a benefit by allowing you to skip the restore of LOG backups 1-4.
Code Snippets
t01 FULL database backup 1
t02 Log backup 1
t03 log backup 2
t04 Log backup 3
t05 log backup 4
t06 Database DIFFERENTIAL backup 1
t07 log backup 5Context
StackExchange Database Administrators Q#146037, answer score: 6
Revisions (0)
No revisions yet.