Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Capturing deadlock info Expand / Collapse
Author
Message
Posted Wednesday, March 20, 2013 6:56 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 9:41 AM
Points: 247, Visits: 975
I am looking for advice on capturing deadlock info.
Can somebody please address the follwoing points :
1. Does enabling trace flags T1204 AND T1222 have any impact on server performance and do i need to restart the sql server service to do this as the boss has said this really isnt an option.
2. If i run profiler i understand it will have to be running at the time a deadlock occurs to capture info - what are the events i need to capture ? - Is there anyother way to capture the info - for example is a server side trace a better option ?
3.Any links to good advice on troubleshooting deadlocks would be appreciated.

Many thanks
Steve
Post #1433183
Posted Wednesday, March 20, 2013 7:28 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Tuesday, December 17, 2013 3:27 PM
Points: 481, Visits: 782
Trace flag 1222 became available in SQL 2005, and is a lot easier to read than 1204.

You will want to run just trace flag 1222. Since there will be some overhead you can switch it on for with "DBCC TRACEON (1222, -1)", wait for the deadlock to reoccur - capturing information in the error log, and then switch it off . Alternatively, 1222 can be added as a startup parameter "-T1222", but this will require a restart.

SQL Profiler can capture the deadlock graph, but it does have to be running at the time of the deadlocking event. It is quite simple to configure. You can run a server side trace to limit the overhead.

Another alternative for troubleshooting deadlocks is to view the extended events deadlock graph. This is most likely already running and past deadlock events are available to you on your SQL Server.

Do a search on this site for any of the above topics. There are many articles on this site, and many helpful postings that will get you started troubleshooting deadlocks.

Bret


Post #1433195
Posted Wednesday, March 20, 2013 12:00 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 5:14 PM
Points: 7,125, Visits: 12,719
If you go with a Trace flag you only need to enable one or the other. If I use them I'll pick 1222 because it offers a cleaner output. The overhead it adds is minimal so unless your server is under duress you will not need to worry about impacts from enabling it.

The WMI method in this article is worth implementing too. This article is a comprehensive walk through of all your options:

Handling Deadlocks in SQL Server

If you need help interpreting the deadlock information once captured post a new thread. There are many capable people on these forums that can assist.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1433385
Posted Friday, March 22, 2013 4:32 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 3:26 PM
Points: 13,871, Visits: 28,266
Since this is a post to a 2008 forum, you should know that you're already capturing deadlock information in the system_health extended events session that is running on your servers, right now. You no longer have to go the route of setting traceflags and digging through the error log. You can read about it in more detail here.

----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of: SQL Server Query Performance Tuning
SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #1434189
Posted Friday, March 22, 2013 5:01 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 9:41 AM
Points: 247, Visits: 975
Thanks very much for this - I will defo check this out.
Look forward to hearing you speak at the sql in the city conf, London in June !!!
Thanks
Steve
Post #1434197
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse