创建SQL Server 数据库时出现错误“Could not obtain exclusive lock on database 'model'”
尝试以下方法:
1. to try reconnecting to the database.
2. Restarting the service.
3. killing the spid holding the lock.
执行以下SQL语句来查询:
select d.name, resource_type,resource_database_id,request_mode,request_status,request_owner_type,request_type
from sys.databases d inner join sys.dm_tran_locks l
on d.database_id = l.resource_database_id
and l.resource_database_id = 3
select spid ,PROGRAM_NAME from master..sysprocesses
where DB_NAME(dbid) = 'model'