Analyze deadlocks with Sql Server 2005: Profiler DeadLockGraph object.
SqlServer Profiler 2005 contains some new features, one of which is the DeadLockGraph object. With this object enabled in the trace options you can visually see when deadlocks occur, what tables and statements are involved and who was choosen as the deadlock victim.
To do this you should start a new trace in the Sql Server 2005 Profiler. When you create a new trace and after you have connected to the sql instance you would like to monitor you have to select the events you are interested in. You can find them in the 'Events Selection' tab of the trace properties window. Here you have to check the 'Deadlock graph' event. You notice that as soon as this event is selected, a new tab becomes available in the trace properties window: the 'Events Extraction Settings':
If now while the trace is running a deadlock occurs you will be able to see the deadlock graph:
In this graph you really get a lot of information about the deadlock: The statements that are involved, the kind of lock, the victim, the spid of the deadlock process, ... And that's not all, if you right click on the graph you can export to an XML file. This file can then be opened with the Management Studio for further analysis.
The Sql profiler has also other enhancements, like for example the possibility to compare/merge the Sql Profiler data with the data coming from a Windows Performance Monitor. If you run a profiler trace and a perfmon trace at the same time you can then save the 2 trace logs and merge them ! But I will tell more on this in another blog message soon ;-)
Recent Comments