Solved

Restore databse from .bak

Posted on 2009-05-12
4
458 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
[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 5

Accepted Solution

by:
BryanMI earned 500 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
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…

626 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