开发者

how to track which transactions are hung on a SQL server

i am developing a monitoring application which determines which transactions on the SQl server are hung开发者_运维技巧. how can i know which applications are hung ? is there some particular API for this ?


You should have a look at Transaction Related Dynamic Management Views and Functions (Transact-SQL), notably sys.dm_tran_active_transactions


The below gives those sessions that are currently blocking others.

SELECT S.*
FROM sys.dm_exec_requests R
INNER JOIN sys.dm_exec_sessions S
ON S.session_id = R.blocking_session_id


On older versions you can also use aba_lockinfo or the newer beta_lockinfo


We can also run below command to see open transactions in a database.

DBCC opentran()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜