Our Jr. DBA ran to me with this error just a few days ago while restoring the database.
Error 3154: The backup set holds a backup of a database other than the existing database.
Solution is very simple and not as difficult as he was thinking. He was trying to restore the database on another existing active database.
Fix/WorkAround/Solution:
1) Use WITH REPLACE while using the RESTORE command. View Example
2) Delete the older database which is conflicting and restore again using RESTORE command.
I understand my solution is little different than BOL but I use it to fix my database issue successfully.
3) Sample Example :
RESTORE DATABASE AdventureWorks
FROM DISK = 'C:\BackupAdventureworks.bak'
WITH REPLACE
Reference : Pinal Dave (https://blog.sqlauthority.com)
302 Comments. Leave new
thnx
Excellent! Thanks.
Magic…..
thank you pinal
the simple code was easy to use and it worked like a charm
thanks
WOW, you saved a life out there somewhere in Atlanta man…. I was dead before this.. you win two internets!
Thanks. This tip should be on the main page of Microsoft SQL Server issues?
Why isn’t it there yet?
Thank you very much, you saved my ass.
LOL
hay thanx it really helped me alot
Great Work…… very helpful and efficient technique !!!!!!!
Thank you Thank you!!!
Your my idol!!
Thank you very much! Great Help!
Thanks a bunch cos FIX No 1 solved my problems perfectly.
Is this possible to replace filegroup with restore command with replace
Mate,
That is golden
Nice Work
Super. Worked like magic. Thanks a lot!!!!
Is there a way to delete/drop a database backup from the tape device? Please kindly advise.
thanks.
Thanks Pinal….Keep up this nice work…..cheers
Hi
Thanks for the answer, mate. It was spot on. For newbies like me this was a great help
Cheers, Prad
Saved me a lot of trouble, thanks