- Adam Thurgar
Enable deadlock alerting
One of the difficulties in dealing with deadlocks is actually knowing that they occurred and then getting information. Even if you have enable the right trace flags, you are only part of the way there. The 1205 deadlock message is not logged and this means that it could be missed. So you need to log this message by
EXEC master..sp_altermessage 1205, 'WITH_LOG', true;
Then you can add an alert for message_id 1205.
With this alert I then call the SQL Server Agent job for sp_whoisactive (to a logging table) to catch what is happening at the time the 1205 alert happened. Then use the the system_health extended events for the xml_deadlock_report.