Solved

Problem with restoring database on SQL Server 2008

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

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

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

In this article I will describe the Copy Database Wizard 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 article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Viewers will learn how the fundamental information of how to create a 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…

728 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