Problem:
One day when i was creating a new database, i was notified as "Could not obtain exclusive lock on database 'model'. Retry the operation later" and i could not able to sucees to created that database.
The error looks,
TITLE: Microsoft SQL Server Management Studio
Create failed for Database 'NewDatabase'. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.0.1600.22+((SQL_PreRelease).080709-1414+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+Database&LinkId=20476
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
Could not obtain exclusive lock on database 'model'. Retry the operation later.
CREATE DATABASE failed. Some file names listed could not be created. Check related errors. (Microsoft SQL Server, Error: 1807)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.1600&EvtSrc=MSSQLServer&EvtID=1807&LinkId=20476
I have the checked any open transactions which have locked the "Model" database, But no any processes were locked for this database.
Everything were OK with this database. Finally i have checked the processes or connections to this databases in process, And one connection was from Management studio.
The script to find connection of "Model" database.
SELECT
*
FROM SYS.SYSPROCESSES
where dbid = DB_ID('model')
GO
Solution:
After disconnecting from "Model" database i have tried one more time to create a new database.
Then i was able to sucessfully create it. This is becuase of new database is created from "Model" database.
Let me share your experience if you got this errors and what you did for the resolutaion for the same. Also share the reason for this type of errors.