Skip to content Skip to sidebar Skip to footer

Exclusive Access Could Not Be Obtained Because The Database Is In Use - But The Database Is Deleted

Has anyone run into this error even when the database is deleted? I deleted the database and checked the 'close existing connections' box before deleting. I have a Live db and a T

Solution 1:

It is always better to close existing connections before deleting

ALTER DATABASE MyDB
SET SINGLE_USER
WITHROLLBACK IMMEDIATE;

Reattach it with same name and rename the database. Or restore with norecovery

RESTORE DATABASE TEST FROM DISK ='C:\Live.BAK'WITH NORECOVERY
RESTORE LOG TEST FROM DISK ='C:\LIVELOG.trn'

-- Moving file lcoations

WITH MOVE 'MDFLogicalName'TO'C:\test.mdf',
MOVE 'LDFLogicalname'TO'D:\Test.ldf'

Post a Comment for "Exclusive Access Could Not Be Obtained Because The Database Is In Use - But The Database Is Deleted"