SQL中查询现有未释放连接

SELECT 
dbid,count(1)
FROM
[Master].[dbo].[SYSPROCESSES] 
WHERE spid>50 and status='sleeping'

group by dbid
order by count(1) desc





select * from master.dbo.sysprocesses where spid>50 
and   waittype   =   0x0000   
and   waittime   =   0   
and   status   =   'sleeping'   
and   last_batch   <   dateadd(minute,   -10,   getdate())   
and   login_time   <   dateadd(minute,   -10,   getdate())   

 

posted @ 2019-05-20 11:02  代码工人有力量  阅读(1520)  评论(0编辑  收藏  举报