SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Script to kill the top blocker and report what it was doing.

By integer,

This script identifies the blocking locks at the top of the blocking chain and kills them. Specifically, it reports what the top blocking spids are doing, kills them, waits three seconds and then reports on current blocking status.  If you have a situation where single connections are causing a huge blocking chain and you want to kill the absolute minimum number of spids, then this script is for you.  There is a safety valve in the script to determine the age of the blocks to kill. By default the script kills only the spids at the top of the blocking chain (Thus freeing all blockers and spids below it) if the blocker is older than 5 seconds.

Total article views: 2479 | Views in the last 30 days: 4
Related Articles

Retrieve locking block-chain

This script utilize the DMV to quickly build the locking block-chain.


Blocking Chain (SQL Spackle)

Problems with blocking processes can be easy to identify with SQL Server DMV's.


SQLDIY: Alert On Blocking Chains

Continuing the SQLDIY monitoring project we will take a look at tracking blocking events. I actually...


Blocked Users Script

This script gives you info about blocked sessions, program name, wait_type, duration and SQL text of...