Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Problem with restoring database on SQL Server 2008

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

610 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