Solved

Problem with restoring database on SQL Server 2008

Posted on 2011-02-25
5
293 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

839 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