Monday, July 2, 2012

Query to find Blocking


We can find out the blocking by running following query. If this query results something then definitely there is blocking in the server.



select
spid,
blocked,
waittype ,
waittime,
lastwaittype,
dbid ,
uid,
cpu,
physical_io,
memusage ,
login_time,
last_batch, hostname ,
program_name,
nt_domain,
nt_username,
loginame
from master..sysprocesses
where blocked <> 0
or spid in (select blocked from master..sysprocesses)

No comments:

Post a Comment