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

x
?
Solved

restore a .bak file

Posted on 2010-08-17
4
Medium Priority
?
339 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
  • 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 25

Accepted Solution

by:
DBAduck - Ben Miller earned 2000 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

972 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