Blocked Process script for deadlock correction

  • David A. Long

    SSCrazy Eights

    Points: 8421

    Comments posted to this topic are about the item Blocked Process script for deadlock correction

  • harlan.pooley

    Newbie

    Points: 9

    I don't understand how the last_batch for the blocker corresponds to someone waiting for a blocker. If you are getting the blocking spid record how is his last_batch value related to those being blocked?

    -- get the blocking spid

    SELECT @spid = spid, @hostname = hostname FROM master.dbo.sysprocesses

    -- %%% Adjust > 120 to the number of seconds a processes has been blocked

    -- before loging the data, notifying, and killing the Blocking process

    WHERE blocked = 0 AND (convert(money,getdate()-last_batch)* 86400.0) > 120

  • John Rempel

    SSCommitted

    Points: 1815

    I need to implement something like this soon. This article is a few years old so I'm wondering if there are other ideas out there. If not, is there a newer version of this script?

    Many thanks.

  • logicinside22

    SSCrazy Eights

    Points: 9617

    You can find here the newer one

    http://www.sqlservercentral.com/scripts/sp_who2/72823/

    Aim to inspire rather than to teach.
    SQL Server DBA

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply