반응형
/**********************************************************************************************
-- Title : [2k] 오래 수행되는 트랜잭션 확인 쿼리

-- Reference : dbguide.net
-- Key word : sysprocesses syslockinfo
**********************************************************************************************/
select spid, cmd, status, loginame, open_tran, datediff(s, last_batch, getdate()) as [wait time(s)]
from master.dbo.sysprocesses p with (nolock)
where open_tran > 0
and spid > 50
and datediff(s, last_batch, getdate()) > 20
and exists (select * from master.dbo.syslockinfo where req_spid=p.spid and rsc_type<>2)
반응형

+ Recent posts