Jump to content

Could not obtain exclusive lock on database 'model'.


Michael Atkin

Recommended Posts

  • Administrators

If you see the error "Could not obtain exclusive lock on database 'model'." then you will be unable to create new databases (case, client, etc..).

 

The following query will confirm whether the model database has an exclusive lock:

IF EXISTS (
       SELECT request_session_id
       FROM sys.dm_tran_locks
       WHERE resource_database_id = DB_ID('model')
       )
BEGIN
   PRINT 'Model Database currently in use!'

   SELECT *
   FROM sys.dm_exec_sessions
   WHERE session_id IN (
           SELECT request_session_id
           FROM sys.dm_tran_locks
           WHERE resource_database_id = DB_ID('model')
           )
END
ELSE
   PRINT 'Model Database not in use.'

 

In order to unlock it you will need to find what SQL process has locked it using either sp_whoisactive or sp_who2. Look for any queries that are running against the eCapture, Eclipse, of Nucleus config databases and clear them out to release the exclusive lock

Link to comment
Share on other sites

  • Administrators

If you see the error "Could not obtain exclusive lock on database 'model'." then you will be unable to create new databases (case, client, etc..).

 

The following query will confirm whether the model database has an exclusive lock:

IF EXISTS (
       SELECT request_session_id
       FROM sys.dm_tran_locks
       WHERE resource_database_id = DB_ID('model')
       )
BEGIN
   PRINT 'Model Database currently in use!'

   SELECT *
   FROM sys.dm_exec_sessions
   WHERE session_id IN (
           SELECT request_session_id
           FROM sys.dm_tran_locks
           WHERE resource_database_id = DB_ID('model')
           )
END
ELSE
   PRINT 'Model Database not in use.'

 

In order to unlock it you will need to find what SQL process has locked it using either sp_whoisactive or sp_who2. Look for any queries that are running against the eCapture, Eclipse, of Nucleus config databases and clear them out to release the exclusive lock

Link to comment
Share on other sites

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...