restoration error

Posted on 2006-05-18
Last Modified: 2012-06-27
I've been restoring db's for the last few days....after i get the data i need, i restore another file, overwriting it w/the next dump.  everything has been going fine.  this morning, however, my restore gave me an error -

Server: Msg 5173, Level 16, State 2, Line 1
Cannot associate files with different databases.

now, it was pointing to the Log file, and mind you, it was still running.  but, in QA the message tab where the results are given, the msg 5173 was the first message returned, then it was indicating the restore was at 8%...and still running.  i've never seen that before.  so i killed the restore, checked things out with RESTORE FILELISTONLY, to make sure I hadn't type-o'd, everything appeared fine.  so, after killing it, i re-started the restore with the very same .bak file.  it's now sitting at 48% complete, still running, and no msg 5173 has been returned.  any insight as to why/what's up?  

Question by:dbaSQL
    LVL 142

    Accepted Solution

    you have to use the WITH MOVE option to put the database files to another location than the first database
    if you use the Enterprise Manager, go to the second tab of the restore screen, where you have the list of the files. put some file names that are not associates to an existing database
    LVL 17

    Author Comment

    yep, understood, angel.  that's what i did.  as i said, i've been doing a lot of them over the past few days -- i got through each of these, it was the last one that issued the 5137 to me.  and, btw, it just completed successfully.  i've never seen this before, very odd that it errored, continued to restore after the error was fired, and then, after i killed it and re-started, it restored w/out the error????

    RESTORE DATABASE databasename
    --FROM DISK = '\\servername\g$\MSSQL\databasename_db_20060328.BAK'
    --FROM DISK = '\\servername\D$\RESTORE\databasename_db_20051130.BAK'
    --FROM DISK = '\\servername\D$\RESTORE\databasename_db_20051001.BAK'
    FROM DISK = '\\servername\D$\RESTORE\databasename_db_20051031.BAK'
    MOVE 'databasename_Primary' TO 'D:\MSSQL\DATA\databasename_Primary.mdf',
    MOVE 'databasename_Data' TO 'D:\MSSQL\DATA\databasename_Data.ndf',
    MOVE 'databasename_Log' TO 'D:\MSSQL\LOG\databasename_Log.LDF'
    LVL 142

    Expert Comment

    by:Guy Hengel [angelIII / a3]
    possibly you forgot the REPLACE statement...
    LVL 17

    Author Comment

    no, that's cut/pasted straight from QA.  since i've been doing so many of the darn things, i saved the .sql...
    w/exception, of course, to the 'servername' and 'databasename', it's precisely what i've got in qa
    LVL 17

    Author Comment

    i am going to close this, angel, and i'll give you the points just for getting back to me.  still, would be nice to know why this occurred

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
    This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
    Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

    755 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

    21 Experts available now in Live!

    Get 1:1 Help Now