Solved

restore a database

Posted on 2006-10-25
3
318 Views
Last Modified: 2012-05-05
I am trying to restore a database using its full backup BAK file taken earlier from a server. We were on the process of transferring all the databases from a 2000 system on an old server to a 2005 system on a new server during the time this BAK file is taken. According to the error message below I think this BAK file is for 2005 version on the new server but I am not positive.

Now when I try to store it to a database on my own PC (2005), I got:
System.Data.SqlClient.SqlError: Directory lookup for the file "D:\SQL\mydatabase.mdf" failed with the operating system error 21(The device is not ready.).(Microsoft.SqlServer.Smo)                 --note: D:\SQL\ is the pathname for the database files on the server.

When I try to store it to the server (2005) with a different database name, I got:
System.Data.SqlClient.SqlError: The file 'D:\SQL\mydatabase.mdf' cannot be overwritten. It is being used by database 'mydatabase'.(Microsoft.SqlServer.Smo)

My questions are:
1. Does this mean I can't restore the database to a different machine? But I was able to do the same with SQL 2000 to any machines without a problem.
2. The error message on the server seems to indicate it's trying to overwrite the existing database although I have specified a different database name. What can I do to bypass the problem?

Thanks.
0
Comment
Question by:sdc248
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 20

Accepted Solution

by:
Sirees earned 125 total points
ID: 17806673
Are you restoring the backup file or attaching the .mdf file?


<<--note: D:\SQL\ is the pathname for the database files on the server.>>

If you are restoring on your PC, that path should point to your PC and not the server.




0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to shrink a transaction log file down to a reasonable size.

726 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