Solved

Problem with restoring database on SQL Server 2008

Posted on 2011-02-25
5
263 Views
Last Modified: 2012-06-27

I have two MS-SQL Server 2008 databases (same structure) but different names on two machines. I have made a backup from machine A and want to restore it on machine B. However, when I restore it on machine B I get following error:

“The backup set holds a backup of a database other than the existing ‘mydb’ database”.

Can somebody give some idea what is wrong and how I can fix it?


Thanks,
ak
0
Comment
Question by:akohan
5 Comments
 
LVL 17

Expert Comment

by:dbaSQL
ID: 34981937
Use WITH REPLACE while using the RESTORE command
0
 
LVL 17

Expert Comment

by:dbaSQL
ID: 34981946
Similar to this example:

ALTER DATABASE AdventureWorks
SET SINGLE_USER WITH
ROLLBACK IMMEDIATE
RESTORE DATABASE AdventureWorks
FROM DISK = 'C\:BackupAdventureworks.bak'
WITH MOVE 'AdventureWorks_Data' TO 'C:\Data\datafile.mdf',
MOVE 'AdventureWorks_Log' TO 'C:\Data\logfile.ldf',
REPLACE

0
 
LVL 9

Expert Comment

by:rawinnlnx9
ID: 34982005
Yeah if you are using the UI to do it you want to go into the options tab (Not the General) and have it 'overwrite existing database'. I believe this is the same as REPLACE with RESTORE.
0
 
LVL 9

Accepted Solution

by:
Stephan_Schrandt earned 500 total points
ID: 34982010
delete the existing mydb at machine B and then restore from backup
0
 

Author Closing Comment

by:akohan
ID: 34983048
Thanks!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
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.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
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…

762 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

19 Experts available now in Live!

Get 1:1 Help Now