Solved

SQL Server--piecemeal restore of filegroups from complete backup

Posted on 2014-09-22
3
284 Views
Last Modified: 2014-09-28
We have a large database in MS SQL in which one of the tables is partitioned by a date column.  The Primary key index is also partitioned using the same partition function.  The database is kept in Simple Recovery model, since data is added to it in batches every 3 months.

DBCC checkfilegroup found consistency errors, so we needed to bring back just one filegroup from a complete backup.

Restore did not allow me to run a restore of a filegroup in Simple Mode, so I changed to full recovery mode, then ran the following, with no errors.

restore database aricases filegroup='2003'
from disk=N'backupfile-name.bak'
with recovery

I expected the "with recovery" clause to bring this back to working order, but the process ended with a note saying

The roll forward start point is now at log sequence number (LSN) 511972000001350200037. Additional roll forward past LSN 549061000001370900001 is required to complete the restore sequence.

When I query the database table that includes this filegroup I get a message saying that the primary key cannot be accessed because one of the partitions for the table cannot be access because it is offline, restoring, or defunct.

Why didn't "with recovery" clause leave this filegroup fully restored.  Now what?
The entire database is very large (1.5TB).  I can't backup the log file, because I'd first need to create a backup in full model mode.  The filegroup itself is only 300gb.

I can do the restore again-- but would like to know the correct way of performing this.
0
Comment
Question by:dakota5
  • 2
3 Comments
 
LVL 46

Expert Comment

by:Vitor Montalvão
ID: 40338496
I think the others filegroups are offline and you need to bring them online.
Just a simple RESTORE DATABASE aricases FILEGROUP='1', ..., FILEGROUP='n'  WITH RECOVERY will do the job,
0
 

Accepted Solution

by:
dakota5 earned 0 total points
ID: 40339084
Vitor-- thank you for your answer, but no, the other filegroups were online and could be queried.  It was the single restored filegroup that was non-functional.

I found the answer.  Bottom line is that Simple Recovery Model is very limited.  You must restore ALL read/write filegroups together from the same backup.  Individual read/only filegroups CAN be restored separately, as long as they became read/only (no more changes) BEFORE the last backup of the  read/write filegroups.

Bottom line-- only Full or Bulk-Logged models let you restore single read/write filegroups.
Bulk-Logged model is what a datawarehouse with batch loading should be using, not Simple Model.  My error in design.

see from Microsoft

http://msdn.microsoft.com/en-us/library/ms191253.aspx

then look at piecemeal restores for Simple Model
http://msdn.microsoft.com/en-us/library/ms190984%28v=sql.100%29.aspx
very limited
0
 

Author Closing Comment

by:dakota5
ID: 40348360
I found the answer documented by Microsoft and have referenced it.  I thank Vitor for his suggestion, but it was not actually correct.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now