Create database fails – Could not obtain exclusive lock on database ‘model’.
Quick and easy today, When I did a manual deployment of my standard scripts i ran into an interesting issue, when creating a database i get the error:
Msg 1807, Level 16, State 3, Line 17
Could not obtain exclusive lock on database ‘model’. Retry the operation later.
Msg 1802, Level 16, State 4, Line 17
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
The solution is to close SQL Server Management Studio and reopen it.