单用户模式下连接被占用定位spid
报错
The database is in single-user mode, and a user is currently connected to it.
通过 select * from sys.sysprocesses 找不到
通过 select * from sys.dm_exec_requests 也找不到
只能通过 sys.dm_tran_locks查看
SELECT request_session_id FROM sys.dm_tran_locks WHERE resource_database_id = DB_ID('your_dbname')
KILL spid