Find root cause of blocking process on SQL Servers



In a SQL Server environment, if lots of processes are blocked, sometimes it is hard to find actual blocking process.
Generally one process blocks other, and that process blocks another, and so on. At first glance it is not possible to find the real process which is massing up all the thing.

With the T-SQL code below it is possible to identify the process which blocks the others.


select distinct blocked as [Blocking Process] from sys.sysprocesses
where  blocked != 0
and blocked not in (select spid from sys.sysprocesses where blocked != 0)

No comments:

Post a Comment