Database Restore Errors

  • Hello, I am running the below restore script and getting errors. Please advise what I need to do to correct.

    RESTORE DATABASE [TestDB1]

    FROM DISK = N'S:\TestDB1\TestDB1_Backup_20120625.bak' WITH FILE = 1,

    MOVE N'NG_System_Data' TO N'E:\TestDB1\TestDB1.mdf',

    MOVE N'NG_Core_Data_1' TO N'E:\TestDB1\TestDB1.mdf',

    MOVE N'NG_Index_1' TO N'E:\TestDB1\TestDB1.mdf',

    MOVE N'NG_Log' TO N'E:\TestDB1\TestDB1_1.ldf',

    NOUNLOAD,

    REPLACE,

    STATS = 10

    GO

    I get the following errors:

    Msg 3176, Level 16, State 1, Line 1

    File 'E:\TestDB1\TestDB1.mdf' is claimed by 'NG_Core_Data_1'(4) and 'NG_System_Data'(1). The WITH MOVE clause can be used to relocate one or more files.

    Msg 3176, Level 16, State 1, Line 1

    File 'E:\TestDB1\TestDB1.mdf' is claimed by 'NG_Index_1'(3) and 'NG_System_Data'(1). The WITH MOVE clause can be used to relocate one or more files.

    Msg 3013, Level 16, State 1, Line 1

    RESTORE DATABASE is terminating abnormally.

  • You've given the same physical file name to all three of the data files. They need to all be different physical files, so each of the data files needs a different physical file name.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • You are using the same file name for 'NG_System_Data', 'NG_Core_Data_1' and 'NG_Index_1'. Try moving them to different files and it should work.

    - Rex

  • Yep, that seems to be working now. Thank you!

  • How can I get the first error? Error_number only returns 3013 RESTORE DATABASE is terminating abnormally.

    When the actual error is 3176 File 'M:\SQLData\SQL2016\SolarWindsOrion_Cortex_document' is claimed by 'Cortex_documents2'(4) and 'Cortex_documents1'(3). The WITH MOVE clause can be used to relocate one or more files.

    Darryl Wilson
    darrylw99@hotmail.com

  • Darryl Wilson wrote:

    How can I get the first error? Error_number only returns 3013 RESTORE DATABASE is terminating abnormally.

    When the actual error is 3176 File 'M:\SQLData\SQL2016\SolarWindsOrion_Cortex_document' is claimed by 'Cortex_documents2'(4) and 'Cortex_documents1'(3). The WITH MOVE clause can be used to relocate one or more files.

    Please post the code that you're having problems with.  Be sure to include the error detection and handling code, which is probably where the problem is (my suspicion is based on your use of the "Error_number" in your post.

    Also, I'm pretty sure that other will suggest that you start your own question on the forum instead of tailgating a thread started almost 8 years ago.  If you do that, please post the link of that new thread on this one because your question is a great follow-up question to this original thread.

    Thanks.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • oradbguru wrote:

    ...MOVE N'NG_System_Data' TO N'E:\TestDB1\TestDB1.mdf', MOVE N'NG_Core_Data_1' TO N'E:\TestDB1\TestDB1.mdf', MOVE N'NG_Index_1' TO N'E:\TestDB1\TestDB1.mdf', MOVE N'NG_Log' TO N'E:\TestDB1\TestDB1_1.ldf', NOUNLOAD, REPLACE, STATS = 10 GO...

     

    You are moving multiple files to the same file destination. That cannot be done this way in sqlserver !

    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 7 posts - 1 through 6 (of 6 total)

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