5

I have a database which has two filegroups (both r/w), each with two files. The backup sequence was:

  1. Full Backup
  2. Several transaction log backups (tlog set1)
  3. Full Backup of file1 of filegroup1
  4. Several transaction log backups (tlog set2)
  5. Full Backup of file2 of filegroup1
  6. Several transaction log backups (tlog set3)
  7. Full Backup of file1 of filegroup2
  8. Several transaction log backups (tlog set4)
  9. Full Backup of file2 of filegroup2
  10. Several transaction log backups (tlog set5)
  11. 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 tail

would 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 backup, then roll forward to the present. I want to minimize the number of times I have to apply a log backup.

5

The first sequence you wrote is correct:

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 tail

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.

0

There are several examples online (Microsoft...and several others by the community) for how to achieve (I think) what you're trying to do.

Here are the top examples I found in the official documentation:

  1. Example: Piecemeal Restore of Only Some Filegroups (Full Recovery Model)
  2. Example: Piecemeal Restore of Database (Full Recovery Model)
  3. Example: Online Restore of a Read-Write File (Full Recovery Model)

Please respond if these links are not helpful in your situation.

  • The issue of those examples is that they are restoring 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 backup, then roll forward to the present. I want to minimize the number of times I have to apply a log backup. – Xingzhou Liu Aug 3 '17 at 19:12
  • Oh, I see. I'm sorry I didn't pick up on that from your original question. I'm not sure how to answer regarding multiple filegroup/file restores. – SQL_Hacker Aug 3 '17 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.