Solved

restore a database

Posted on 2006-10-25
3
275 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
3 Comments
 
LVL 20

Accepted Solution

by:
Sirees earned 125 total points
Comment Utility
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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
CREATE DATABASE ENCRYPTION KEY 1 41
Access recordset not updateable 8 38
SQL JOIN 6 31
MS SQL Pagination for Complex Query 5 31
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
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.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

744 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

16 Experts available now in Live!

Get 1:1 Help Now