SQL Server – Error 3154: The backup set holds a backup of a database other than the existing database
Sometime we faced the following error message while restoring the database
Error 3154: The backup set holds a backup of a database other than the existing database.
Solution:
Use WITH REPLACE while using the restore script as
Script 1
RESTORE DATABASE YourDB FROM DISK = 'C:\YourDB.bak' WITH REPLACE
Script 2
-- Get the Logical file name of the database from backup. RESTORE FILELISTONLY FROM DISK = 'C:\YourDB.bak' GO RESTORE DATABASE YourDB FROM DISK = 'C\:YourDB.bak' WITH MOVE 'YourDB_Data' TO 'C:\Database\YourDB.mdf', MOVE 'YourDB_Log' TO 'C:\Database\YourDB.ldf', REPLACE
Or
Delete the older database which is conflicting and restore again. It will work.
Hello Varinder,
I just wanna to say thanks for this informative suggestion. It has helped me a lots.
Regards,
Mark Willium
Blog
Hello Mark
Good to know, the post helped you. thanks