While restoring a db in production server . I got a following issue

i tried to restored using wizard it failed
Error 3154: The backup set holds a backup of a database other than the existing database.


first i tried following sql command

RESTORE DATABASE AdventureWorks
FROM DISK = 'C:\BackupAdventureworks.bak'
WITH REPLACE

It raised following error

Exclusive access could not be obtained because the database is in use.

Later i tried following sql script

ALTER DATABASE MyDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE
no result same error

fix:

ALTER DATABASE MyDatabaseName SET MULTI_USER WITH ROLLBACK IMMEDIATE;


Popular Posts