Restoring database - Filegroups

  • I am restoring a database, one filegroup at a time.

    I get the following error when I am restoring the second filegroup. I have totally x filegroups to restore.

    The database can not be brought online because file 'Databasenamedata1' is currently restored to LSN 265000005575300001 but must be restored to LSN 265000005572900001.

    I am not sure as to how I could avoid this error.

    Info:

    I am have backed up and restored "Primary" filegroup. Database was online until I tried to restore the "DATA" filegroup after restoring the primary filegroup.

    More Info:

    My Backup script:

    BACKUP DATABASE Databasename

    FILEGROUP = 'DATA'

    TO DISK = 'C:\Databasenamedata.bak'

    GO

    My restore Script:

    RESTORE DATABASE Databasename

    FILE = 'Databasenamedata1'

    FROM DISK = 'C:\Databasenamedata.bak'

    WITH MOVE 'Databasenamedata1' TO 'c:\DatabasenameTSTdata1.ndf'

    , replace

    GO

    Thanks.

  • I believe that you need to specify the WITH PARTIAL, NORECOVERY option when restoring mulitiple file groups. I've used something like...

    RESTORE [database]

    FILE = [filename]

    FROM DISK 'C:\PathOfBackupFile.bak'

    WITH PARTIAL, NORECOVERY

    MOVE [filename] TO 'C:\NewPath.mdf.'

    That would get the primary restored, but leave the database in Recovery so you can restore the rest of your filegroups and any tran logs before using the WITH RECOVERY to bring the database up.

  • Thanks for your guidance.

    I was wondering if I could bring the database up with Primary filegroup and open it to the users while I add the remaining filegroups (while the database is open to the users)

    Thank you.

  • What your are trying to do is a piecemeal restore.

    (ent edtn / dev edtn needed )

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

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply