Detecting deadlocks with Trace Flag 1204
In the previous recipe, Detecting deadlocks with SQL Server Profiler, we learned to detect deadlocks using SQL Server Profiler. This can be useful when deadlocks occur regularly in a specific pattern and you are able to reproduce them by executing certain part of application code that you know produces the deadlock. For this type of investigation, you simply start an SQL Trace session, reproduce the deadlock condition, and analyze the queries.
However, when deadlocks occur irregularly, without any specific pattern, it becomes hard for you to investigate them because you do not know in which case they occur. Thus, it also becomes difficult for you to reproduce them. To troubleshoot such irregular deadlocks, you might prefer not to keep a trace session running and wait for deadlocks to occur for hours.
This recipe will show you how you can configure SQL Server so that whenever deadlocks occur, SQL Server logs the deadlock-related information into the...