Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SQL Server Restore Database from a backup file

Posted on 2006-11-25
7
Medium Priority
?
6,592 Views
Last Modified: 2010-05-18
I am receiving the following error message when trying to perform a file restore from a backup file named LIPData_Backup.bak ....

File 'G:\Golf' (Pathway) is claimed by 'LIPData_Log'(2) and 'LIPData_dat'(1).  The WITH MOVE Clause can be used to relocate one or more files.
Restore Database is terminating Abnormally.

What am I doing incorrectly, or what can I do differently to restore the database from a .BAK file?


Thank you ~ Stephen
0
Comment
Question by:sbosco21
  • 2
7 Comments
 
LVL 16

Accepted Solution

by:
Hillwaaa earned 672 total points
ID: 18013177
Hi sbosco21,

It looks like you are trying to restore the backup - and the database which the backup was created from still exists.  This means that the files are trying to restore over the top of the existing database.  Using the "WITH MOVE" will allow you to specify exactly where you want the files (.mdf and .ldf) to be for the restored database.  Note that the files will try and restore to the same location that they were in when the backup was taken (by default).

From BOL:

RESTORE DATABASE TestDB
   FROM DISK = 'c:\Northwind.bak'
   WITH MOVE 'Northwind' TO 'c:\test\testdb.mdf',
   MOVE 'Northwind_log' TO 'c:\test\testdb.ldf'

will restore the Northwind database to c:\test\

Cheers,
Hillwaaa
0
 
LVL 28

Assisted Solution

by:imran_fast
imran_fast earned 664 total points
ID: 18013674

Right Click Database Folder --> Click Restore Database---> Specify Database Name and click on Device radio button
--> select the database file --> check the check box -->
Now select option from the Tab and specify the ldf and mdf file path--> click ok--> click ok
0
 
LVL 70

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 664 total points
ID: 18020528
If the db is being restored to the same server it came from, and **you know for sure** that you want to overwrite the previous version of the db that still exists on disk [that is, you want to put the db back over where it was before], either:

1) In Enterprise Mgr, check the "Force Restore over existing database" box
2) In RESTORE command, add the "WITH REPLACE" clause

RESTORE DATABASE DatabaseName
    FROM DISK = ...
    WITH REPLACE
0
 
LVL 16

Expert Comment

by:Hillwaaa
ID: 18263861
Perhaps a split?  All are valid solutions for this problem.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

963 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