Wednesday, June 01, 2011

How to find the blocking transaction on SQL Server

SELECT t.resource_type,
t.resource_database_id,
t.resource_associated_entity_id,
t.request_mode,
t.request_session_id,
w.blocking_session_id
FROM sys.dm_tran_locks as t
INNER JOIN sys.dm_os_waiting_tasks AS w
ON t.lock_owner_address =w.resource_address

No comments: