?
Solved

Problem with restoring database on SQL Server 2008

Posted on 2011-02-25
5
Medium Priority
?
316 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 2000 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

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

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.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how the fundamental information of how to create a table.

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