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

x
?
Solved

Restore databse from .bak

Posted on 2009-05-12
4
Medium Priority
?
460 Views
Last Modified: 2012-05-06
Hi I am trying to restore a databse from a bak file taken from a different database using this script

RESTORE DATABASE coreRedHill
   FROM Disk = 'E:\CoreRedHill\CorePC 27-04-09.bak'
   WITH RECOVERY,
   MOVE 'corepc_Data' TO 'E:\CoreRedHill\coreRedHill.mdf',
   MOVE 'corepc_log' TO 'E:\CoreRedHill\coreRedHill_log.ldf'

GO

The database I want to restore is called coreRedHill that back up is taken from a database called corepc.

I am getting this error

The backup set holds a backup of a database other than the existing 'coreRedHill' database.


I have treid using Replace but no joy, can anyone tell me where I am going wrong please?
0
Comment
Question by:ac_davis2002
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
BryanMI earned 2000 total points
ID: 24366645
Delete the coreRedHill database and then run your restore statement.  You don't need an existing DB to perform a restore operation.
0
 

Author Comment

by:ac_davis2002
ID: 24366909
Thanks for your help!!!!
0
 

Author Closing Comment

by:ac_davis2002
ID: 31580611
first class
0
 
LVL 16

Expert Comment

by:JohnBPrice
ID: 24367270
or use "WITH REPLACE" instead of "WITH RECOVERY".  Basically it's saying you can't RECOVER CoreRedHill from a different database but you can REPLACE it with a different database.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

885 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