Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Dead Lock

Author  Topic 

TRACEYSQL
Aged Yak Warrior

594 Posts

Posted - 2008-01-18 : 17:36:23
Trying to get SQL 2005 to report dead locks via email.

I performed the following
Execute Sp_configure ‘blocked process threshold’, 200

Then generated a deadlock
BEGIN TRAN

UPDATE CUSTOMER
SET CUSTOMER_NAME = 'F'
WHERE CUSTOMER_ID = '1'


WAITFOR TIME '17:52'

ROLLBACK TRAN

Then on another query ran this
SELECT CUSTOMER_NAME FROM CUSTOMER

In sp_who i see it blocked. and the select is waiting for the update.


But i do not get anything reported in logs for the dead lock.

I tried to set up an alert.
MSSQL$ASRCFHSQL2005:Locks
Number of Deadlocks/sec
Total
rises above 1


When doing the reconfigure is something supposed to be written to the logs..........

Trying to set up system so if any dead locks arise i am sent an email

Thanks

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2008-01-18 : 21:16:21
u didnt generate a deadlock, just blocking. not same thing
Go to Top of Page

TRACEYSQL
Aged Yak Warrior

594 Posts

Posted - 2008-01-19 : 09:21:37
Yes now i think about it - How would i get blocks to be emailed.
Go to Top of Page

TRACEYSQL
Aged Yak Warrior

594 Posts

Posted - 2008-01-19 : 09:22:41
i can look in profiler events and warnings and see the blocked process.

Anyone know how to get this to email instead of running profiler so i get notified.
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2008-01-19 : 10:52:17
have a look at this script http://support.microsoft.com/default.aspx?scid=kb;EN-US;271509].

u can modify it to execute a send mail script when blocking is detected
Go to Top of Page
   

- Advertisement -