Focusing on scripts, MOM, SMS, WMI, and any other technologies design to assist operations staff in performing their entire job function from the comfort of their own desk.
I found that block analysis script for SQL 2005 was generating an appropriate alert, but the description is blank. That description is pretty important because it identifies the process blocking and being blocked.
After some investigation, I found that there is a problem on the line of the script building the description - specifically where we include the time that the black has been occuring. This is pulled from the waittime field of the sysprocesses table. It turns out that this field was an Int in SQL 2000 but changed to a BigInt in SQL 2005. The script uses a CInt to covert this value to an Integer which results in an overflow. Since we run into an error building the description, it's left blank in the alert.
Fortunately, this is trivial fix - just a matter of swapping out that CInt. I found that to get a correct calculation, I had to convert to a Double prior to performing the division required to convert the value from milliseconds into minutes.
The offending line is 2240 by my count. Just modify as follows:
Original line
""" has been blocked for " & CStr(CInt(rsBlockedSPIDS("waittime").Value / 1000 / 60)) & _
Changed Line
""" has been blocked for " & CStr(CInt(CDbl(rsBlockedSPIDS("waittime").Value) / 1000 / 60)) & _
Anonymous comments are disabled