Tuesday, 22 August 2017

Could not obtain exclusive lock on database 'model'. Retry the operation later.
-----------------------------------------------------------------------------------------------------
1. Run the below SQL script

Use master
GO
IF EXISTS(SELECT request_session_id  FROM sys.dm_tran_locks
WHERE resource_database_id = DB_ID('Model'))
        PRINT 'Model Database being used by some other session'
ELSE
        PRINT 'Model Database not used by other session'

2. Get the session ID

SELECT request_session_id  FROM sys.dm_tran_locks
WHERE resource_database_id = DB_ID('Model')

3. Check the session ID
DBCC InputBuffer(465)

4. Kill the session

Kill 465

Now you will be able to create the DB

No comments:

Post a Comment