May 01, 2012

SQL Blocking Alert

Here's how to setup an alert for blocking in SQL:
By default, the blocking is set to 5 (the minimum), if it's 0 it's disabled.  As I understand it, it will report an error for any blocks that last as many seconds as specified.  So if it's set to 5, it'll generate an alert when a block lasts for more than 5 seconds.

This MSDN article (http://msdn.microsoft.com/en-us/library/ms181150.aspx) explains how to change the setting.  To check the setting, query the master database:  select * from sys.configurations where name like 'blocked process threshold'.

This thread explains how to setup the alert (http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/945cab5d-b8eb-4c15-93ff-b4ddbba1f7f2?prof=required).  The step I missed when setting up the alert is selecting the Object "SQL Server:General Statistics" Counter "Processes blocked".  Set the desired response and it's ready to go.

I'm now waiting to verify that my alert is functioning properly.