[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


restoration error

Posted on 2006-05-18
Medium Priority
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
  • 3
  • 2
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 500 total points
ID: 16708270
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

ID: 16708800
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????

--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 143

Expert Comment

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

Author Comment

ID: 16708856
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

ID: 16710065
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

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Suggested Courses

834 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