Solved

restore a .bak file

Posted on 2010-08-17
4
328 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
Comment Utility
May be you should rename your existing database before restoring the new one with the same name.

Regards,
Nachi
0
 

Author Comment

by:rgb192
Comment Utility
>>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
Comment Utility
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
Comment Utility
thanks
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

763 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

12 Experts available now in Live!

Get 1:1 Help Now