Solved

restore a .bak file

Posted on 2010-08-17
4
334 Views
Last Modified: 2012-05-10
I am currently using database ow1222
I want to restore a backup and call it ow1222b

RESTORE FILELISTONLY FROM DISK = 'd:\ow1222\ow1222aug16.bak'
d:\ow1222\ow.mdf
d:\ow1222\ow_log.ldf




RESTORE DATABASE ow1222b
   FROM DISK= 'd:\ow1222\ow1222aug16.bak'
   WITH MOVE 'ow' TO 'd:\ow1222\ow.mdf',
   MOVE 'ow_Log' TO 'd:\ow1222\ow_log.ldf'



Msg 1834, Level 16, State 1, Line 1
The file 'd:\ow1222\ow.mdf' cannot be overwritten.  It is being used by database 'ow1222'.
Msg 3156, Level 16, State 4, Line 1
File 'ow' cannot be restored to 'd:\ow1222\ow.mdf'. Use WITH MOVE to identify a valid location for the file.
Msg 1834, Level 16, State 1, Line 1
The file 'd:\ow1222\ow_log.ldf' cannot be overwritten.  It is being used by database 'ow1222'.
Msg 3156, Level 16, State 4, Line 1
File 'ow_log' cannot be restored to 'd:\ow1222\ow_log.ldf'. Use WITH MOVE to identify a valid location for the file.
Msg 3119, Level 16, State 1, Line 1
Problems were identified while planning for the RESTORE statement. Previous messages provide details.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
0
Comment
Question by:rgb192
[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
  • 2
4 Comments
 
LVL 3

Expert Comment

by:mnachu
ID: 33458148
May be you should rename your existing database before restoring the new one with the same name.

Regards,
Nachi
0
 

Author Comment

by:rgb192
ID: 33458488
>>May be you should rename your existing database before restoring the new one with the same name.


i cant rename database because I am using it... are there other options
0
 
LVL 24

Accepted Solution

by:
DBAduck - Ben Miller earned 500 total points
ID: 33458822
RESTORE DATABASE ow1222b
   FROM DISK= 'd:\ow1222\ow1222aug16.bak'
   WITH MOVE 'ow' TO 'd:\ow1222\owb.mdf',
   MOVE 'ow_Log' TO 'd:\ow1222\owb_log.ldf'

You are trying to restore the database ow1222b but use the same filenames, you have to specify new filenames for the new database.  So above I have added a b to the end of the filename so owb.mdf and owb_log.ldf.

The statement above should allow you to restore the database to a new one.
0
 

Author Closing Comment

by:rgb192
ID: 33466315
thanks
0

Featured Post

Independent Software Vendors: 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 This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

630 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