Capturing deadlock info

  • 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:-)

  • 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

  • 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[/url]

    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

  • 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

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • 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:-)

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply