79659819

Date: 2025-06-10 05:20:07
Score: 0.5
Natty:
Report link

-- check for blockings on the server

select * from sysprocesses where blocked <>0

-- check lead blocker

select loginame, cpu, memusage, physical_io, * from master..sysprocesses a where exists ( select b.* from master..sysprocesses b where b.blocked > 0 and b.blocked = a.spid ) and not exists ( select b.* from master..sysprocesses b where b.blocked > 0 and b.spid = a.spid ) order by spid

select 'Lead Blocker', der.session_id as BlockedSessions,convert(numeric(20,2),der.wait_time/1000) as WaitSecs,

der.blocking_session_id as Blocker,der.wait_type,last_wait_type,

wait_resource,cast([text] as varchar (max)) as query_running,command

from sys.dm_exec_requests der

CROSS APPLY sys.dm_exec_sql_text (der.sql_handle) t

where der.session_id in (select blocking_session_id from sys.dm_exec_requests where session_id > 50)

union

select 'victim', der.session_id as BlockedSessions,convert(numeric(20,2),der.wait_time/1000) as WaitSecs,

der.blocking_session_id as Blocker,der.wait_type,last_wait_type,

wait_resource, cast([text] as varchar (max)),command

from sys.dm_exec_requests der

CROSS APPLY sys.dm_exec_sql_text (der.sql_handle) t

where der.blocking_session_id >0

--To check query ran by SPID

dbcc inputbuffer(90)

kill 98

kill 1275

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Rohit Gupta