Sql-server – How to restore a filegroup from its backup in SQL Server

sql serversql-server-2005sql-server-2008-r2

I need guidance on how to restore a file group in Database from the File group backup taken from another same DB server. Is it possible to restore the filegroup by running restore DB for File Group.

I was trying to restoring filegroup from its back up like below

RESTORE DATABASE <DBName > FILEGROUP = 'MFG12' FROM DISK = 'E:\MFG12.bak'
  WITH RECOVERY

The backup set holds a backup of a database other than the existing DBNAME database.

When I was trying to restore in to same DB , restoring works perfectly,

Processed 840976 pages for database 'DB', file 'MFG12_File' on file 1.
RESTORE DATABASE ... FILE=<name> successfully processed 840976 pages in 59.375 seconds  
(110.654 MB/sec).

When I run the Select query against partion of filegroup. it throws error

 One of the partitions of index '' for table 'xyz'
 (partition ID 72057594656129024) resides on a filegroup ("MFG12")
 that cannot be accessed because it is offline, restoring,
 or defunct. This may limit the query result

When I see status of all file group.

I see one of the File Group MFG 12 has status = "Restoring" , How to set back to Online Mode.

When I try to restore log file also.i get below error

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

Please help how do I bring back the missing file group data even though filegroup backup has been taken from another same Database in another server or in the same server DB

Best Answer

  1. After you restore the filegroup, you need to take a tail log backup of the restored database .
  2. Restore the lastest differential you may have to with norecovery.
  3. Restore all the tlog backups to with norecovery.
  4. Restore the tail log backup from step 1 to with recovery.