Solved

restore a .bak file

Posted on 2010-08-17
4
330 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 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

856 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