patternsqlMinor
Piecemeal restore of entire database - fastest way to roll forward and restore multiple files
Viewed 0 times
forwardpiecemealentirewaydatabaserollfilesfastestmultipleand
Problem
I have a database which has two filegroups (both r/w), each with two files. The backup sequence was:
The guidance I found online was that to restore file1, I will need to restore file1 backup, then roll forward tlog sets 1-5 and the tail log.
However, lets say that I need to restore the entire DB in minimal time, can I use the following sequence :
would I have to do
bringing each file online before moving on the next file (or maybe even just use the full backup then applying all the log backups)? Wasn't able to find a definitive answer.
Additionally, is it necessary for me to restore the initial full backup, since the file backups cover the entire database?
The documentation examples restore just one filegroup, which is restore the full file backup then roll forward through every log bringing the filegroup up to date. The case I'm wondering about is if you are restoring multiple file backups, do you have to roll each file forward to the present, or can you restore the first file backup, roll transaction logs to the second file bac
- Full Backup
- Several transaction log backups (tlog set1)
- Full Backup of file1 of filegroup1
- Several transaction log backups (tlog set2)
- Full Backup of file2 of filegroup1
- Several transaction log backups (tlog set3)
- Full Backup of file1 of filegroup2
- Several transaction log backups (tlog set4)
- Full Backup of file2 of filegroup2
- Several transaction log backups (tlog set5)
- tail log backup
The guidance I found online was that to restore file1, I will need to restore file1 backup, then roll forward tlog sets 1-5 and the tail log.
However, lets say that I need to restore the entire DB in minimal time, can I use the following sequence :
Restore file1 filegroup1
restore tlog set2 --roll forward to file 2 backup
restore file2 filegroup1
restore tlog set3
restore file1 filegroup2
restore tlog set4
restore file2 filegroup2
restore tlog set5
restore tailwould I have to do
Restore file1 filegroup1
Restore tlog set2 -- roll forward to current time
Restore tlog set3
Restore tlog set4
Restore tlog set5
Restore tail
Restore file2 filegroup1
Restore tlog set2 -- roll forward to current time
Restore tlog set3
Restore tlog set4
Restore tlog set5
Restore tail
...bringing each file online before moving on the next file (or maybe even just use the full backup then applying all the log backups)? Wasn't able to find a definitive answer.
Additionally, is it necessary for me to restore the initial full backup, since the file backups cover the entire database?
The documentation examples restore just one filegroup, which is restore the full file backup then roll forward through every log bringing the filegroup up to date. The case I'm wondering about is if you are restoring multiple file backups, do you have to roll each file forward to the present, or can you restore the first file backup, roll transaction logs to the second file bac
Solution
The first sequence you wrote is correct:
You have no need to bring online the first file, then the second file, etc as all you want is to restore the whole database in minimal time.
I've just tried the first sequence as I thought it was right and it worked.
I tried then to restore from full backup + all the log files to find out if it was faster and it was. Certainly my database was small enough, just a test database, but you can try to restore your database to another database or to another server in both ways to compare the time.
Restore file1 filegroup1
restore tlog set2 --roll forward to file 2 backup
restore file2 filegroup1
restore tlog set3
restore file1 filegroup2
restore tlog set4
restore file2 filegroup2
restore tlog set5
restore tailYou have no need to bring online the first file, then the second file, etc as all you want is to restore the whole database in minimal time.
I've just tried the first sequence as I thought it was right and it worked.
I tried then to restore from full backup + all the log files to find out if it was faster and it was. Certainly my database was small enough, just a test database, but you can try to restore your database to another database or to another server in both ways to compare the time.
Code Snippets
Restore file1 filegroup1
restore tlog set2 --roll forward to file 2 backup
restore file2 filegroup1
restore tlog set3
restore file1 filegroup2
restore tlog set4
restore file2 filegroup2
restore tlog set5
restore tailContext
StackExchange Database Administrators Q#182628, answer score: 5
Revisions (0)
No revisions yet.