Error 1807 Could not obtain Exclusive lock on database ‘model’. Retry the operation later(During Create database)

Root Cause:

 Root cause of this error may be one of the following reason 
1. If someone exclusively open the Model database in different session 
2. If more than one create database statements attempt to run simultaneously



Identify the session that holding exclusive lock and kill the session depends on the session activity or wait until lock release.



Check if the database is using by some other session or not

Use master


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'


        PRINT 'Model Database not used by other session';



If you see “Model database being used by some other session” then you can identify the session id to find out what kind of statement being used by the session using the below command



SELECT request_session_id  FROM sys.dm_tran_locks

WHERE resource_database_id = DB_ID('Model')


The script will return the session ID (i.e: 55)

We can identify what kind of activity being performing by the session 55.


DBCC InputBuffer(53)



EventInfo column returns the query performed. Based on the activity we can decide to abort the session. If you decided to abort the session then the following way we can kill the session.


Kill 55


Now create a new Database should work.