codebrothers.net :: Home  >  Matthias Denkmaier
User: Guest  Login
Matthias Denkmaier
C# - what else?
Blog search:  
How to: Hunting SQL Server Deadlocks and logging them to file

The following describes the possible ways and the steps needed the get more details about SQL Server dead locks.


The engine saves the information by default to the SQL Server error logs.

 

1. Use the deadlock graph


   You can use the SQL server Profiler and enable the deadlock graph monitoring for a new profiling session.

 

2. Enable trace flags


   By using trace flags SQL Server enables you to output more detailed data about some of the system events.
   When using the trace flag 1204 you will get detailed information about deadlocks in a more textual way.
   The trace flag 1222 gets you the same data but in a simple, but not XDS schema compatible XML way.

 


   
   To enable a trace flag on SQL Server you could start the engine using the /T paramater to define the flag to be set to true.
   or you could execute the follwoing command: "DBCC TRACEON(1204)"


   
   To verify the current status of a specific trace flag you could execute the statement: "DBCC TRACESTATUS (xxx)".


   The statement "DBCC TRACESTATUS (1204)" would return the current value of the deadlock trace flag.

 

 

Share this post: Email it!
Posted:  8/10/2007 8:49:00 AM  by  mdenkmaier
Tags:  SQLHow to
Comments are not allowed on this item!