﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by Shiv Kumar / Article Discussions / Article Discussions by Author  / Tracing Deadlocks / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 21 May 2013 20:06:48 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Tracing Deadlocks</title><link>http://www.sqlservercentral.com/Forums/Topic109787-165-1.aspx</link><description>Hi Shiva Nice post about TF information..I would like to know    [u]Owner:0x0000000BA7ED6780 [/u] this shows in result of  Trace flag output..And how i can know which table are locked from TF 1204 output.</description><pubDate>Wed, 18 Apr 2012 09:31:57 GMT</pubDate><dc:creator>logicinside22</dc:creator></item><item><title>RE: Tracing Deadlocks</title><link>http://www.sqlservercentral.com/Forums/Topic109787-165-1.aspx</link><description>Hello,Does somebody has idea how to identify rows that are involved in deadlock? I can trace deadlock information including SQL statements but I still can't see bonded values or any other information that helps to identify rows. Appreciate your attention!Thank you.</description><pubDate>Fri, 26 Dec 2008 11:56:42 GMT</pubDate><dc:creator>Anatoliy-975407</dc:creator></item><item><title>RE: Tracing Deadlocks</title><link>http://www.sqlservercentral.com/Forums/Topic109787-165-1.aspx</link><description>First off, kudoz to Siva!  I have a more clear picture now that I can better read through the log.  I definitely have a bit of reworking to do, though I do not have the luxury of always accessing objects in the same order all the time.  But that's a story for another time.  I was hoping I could get a lamen's explanation for deadlocks that read:"Transaction (Process ID ###) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.."It then prints out node after node of what appears to be chinese.  From MSDN I gathered that it's attempting to reroute the Query somehow.  Is this worse than the regular deadlocks discussed in the article?  And what the heck is it trying to do?</description><pubDate>Thu, 03 May 2007 16:03:00 GMT</pubDate><dc:creator>kevin mann</dc:creator></item><item><title>RE: Tracing Deadlocks</title><link>http://www.sqlservercentral.com/Forums/Topic109787-165-1.aspx</link><description>&lt;P&gt;for SQL 2005 run &lt;/P&gt;&lt;P&gt;DBCC TRACEON (1204, -1) DBCC TRACEON (1222, -1) &lt;/P&gt;&lt;P&gt;-- to check the status DBCC TRACESTATUS(-1) &lt;/P&gt;&lt;P&gt;for more information please check BOL.&lt;/P&gt;&lt;P&gt;ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/2ed3e3e7-5080-4fa3-b79a-585470602bc2.htm&lt;/P&gt;</description><pubDate>Fri, 06 Apr 2007 12:50:00 GMT</pubDate><dc:creator>VD</dc:creator></item><item><title>RE: Tracing Deadlocks</title><link>http://www.sqlservercentral.com/Forums/Topic109787-165-1.aspx</link><description>&lt;P&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;DBCC TRACEON (3604) &amp;amp; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;DBCC TRACEON (1204)  doesn't seem to work on SQL 2005.....I executed both, in that order on the server and watched the logs only to discover users were, in fact, receiving deadlock errors yet nothing was written to the log??&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;&lt;img src='images/emotions/crying.gif' height='20' width='20' border='0' title='Crying' align='absmiddle'&gt;&lt;/P&gt;&lt;/SPAN&gt;</description><pubDate>Fri, 06 Apr 2007 11:19:00 GMT</pubDate><dc:creator>anoel</dc:creator></item><item><title>RE: Tracing Deadlocks</title><link>http://www.sqlservercentral.com/Forums/Topic109787-165-1.aspx</link><description>&lt;P&gt;I suppose I'm starting to develop a mild if somewhat exasperated affection for SQL Server, but then something like this comes along and annoys me all over again.  It's ludicrous to have to go to this amount of trouble to diagnose something as straightforward as a deadlock.  On DB2 on the mainframe (what a lot of your readers would regard as 'legacy') the thread which gets chucked out receives an error code (a -911 if my memory serves me correctly) and my all-time favourite error message: "This agent has been selected as the victim of a deadlock", which sounds like an instruction from the CIA &lt;img src='images/emotions/tongue.gif' height='20' width='20' border='0' title='Tongue' align='absmiddle'&gt;  But no diagnosis is necessary, nor should it be.&lt;/P&gt;&lt;P&gt;As for how to fix it, it's caused by 2 processes accessing and locking (exclusively) the same data in a different order:&lt;/P&gt;&lt;P&gt;Process 1 has A and is waiting for B.  Process 2 has B and is waiting for A.  And there they will sit until kingdom come unless the system selects one to kill.&lt;/P&gt;&lt;P&gt;A few things to try:&lt;/P&gt;&lt;P&gt;reduce your lock size - table to page, page to row, and force it to stay there.  This has CPU and memory implications, so be careful.&lt;/P&gt;&lt;P&gt;Change your clustering sequence on one of the tables involved (again, look at the bigger picture first).&lt;/P&gt;&lt;P&gt;Ideally, design your apps to access things in the same order.  A lot of deadlocks are just the result of bad and inconsistent coding.&lt;/P&gt;&lt;P&gt;If you have a real database hotspot, like a maximum key which gets both read and updated, try adding a very long field to the table, or a very high fill factor, so you only get one row per page.  If you are deadlocking at row level, rethink your design.&lt;/P&gt;&lt;P&gt;Dinosaur tricks, but they might work.&lt;/P&gt;&lt;P&gt;good luck!&lt;/P&gt;&lt;P&gt;Caroline&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description><pubDate>Fri, 06 Apr 2007 08:35:00 GMT</pubDate><dc:creator>Caroline_b</dc:creator></item><item><title>RE: Tracing Deadlocks</title><link>http://www.sqlservercentral.com/Forums/Topic109787-165-1.aspx</link><description>Once you have executed these commands, the error log starts filling up, so you may want to keep an eye on it from time to time and turn it off if its size is worrying you.You may want to turn it on for a while, and check the logs for "Deadlock encountered.... Printing deadlock information", then turn it off.To the Author:I'd like to know once you have identified what tables etc are part of the problem, how do you go about solving the problem in the first place?</description><pubDate>Fri, 06 Apr 2007 01:04:00 GMT</pubDate><dc:creator>sthornton</dc:creator></item><item><title>RE: Tracing Deadlocks</title><link>http://www.sqlservercentral.com/Forums/Topic109787-165-1.aspx</link><description>&lt;P&gt;thats is really excellent, but i would like to ask a question that its only track the information SPID (Server Process ID), how one can locate that this SPID was running which one query or stored procedure.because if SPID 65 generate the deadlock than , information track is only SPID and delete and after some time this SPID is assgned to other one &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;waiting for a respnose&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description><pubDate>Fri, 06 Apr 2007 01:00:00 GMT</pubDate><dc:creator>adrshen</dc:creator></item><item><title>RE: Tracing Deadlocks</title><link>http://www.sqlservercentral.com/Forums/Topic109787-165-1.aspx</link><description>&lt;P&gt;thats is really excellent, but i would like to ask a question that its only track the information SPID (Server Process ID), how one can locate that this SPID was running which one query or stored procedure.because if SPID 65 generate the deadlock than , information track is only SPID and delete and after some time this SPID is assgned to other one &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;waiting for a respose&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description><pubDate>Fri, 06 Apr 2007 01:00:00 GMT</pubDate><dc:creator>adrshen</dc:creator></item><item><title>RE: Tracing Deadlocks</title><link>http://www.sqlservercentral.com/Forums/Topic109787-165-1.aspx</link><description>&lt;P&gt;This did the trick for me.  I had an instance where I was getting row level dead lock and needed to know how to get the table name based on the informaiton in the RID print out.  This lead me to the table I felt was causing the problem.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;THANK YOU!!!!!!!!!!!!!!!!&lt;/P&gt;</description><pubDate>Wed, 25 May 2005 16:23:00 GMT</pubDate><dc:creator>rsherron</dc:creator></item><item><title>RE: Tracing Deadlocks</title><link>http://www.sqlservercentral.com/Forums/Topic109787-165-1.aspx</link><description>&lt;P&gt;I've got to ask a follow up question.  I am not certain when I should execute the &lt;/P&gt;&lt;P&gt;DBCC TRACEON(3604)DBCC TRACEON(1294)&lt;/P&gt;&lt;P&gt;commands.  For example, I've got a situation in which a deadlock occurs, but maybe only once every three or four weeks.  Do I just go into Query Analyzer, execute those commands now, and wait a few weeks until the problem shows up?  Or do I only execute those commands while the deadlock is in process?&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description><pubDate>Tue, 04 Jan 2005 14:03:00 GMT</pubDate><dc:creator>Doctor Who</dc:creator></item><item><title>RE: Tracing Deadlocks</title><link>http://www.sqlservercentral.com/Forums/Topic109787-165-1.aspx</link><description>&lt;P&gt;DONT WORKED!!&lt;/P&gt;&lt;P&gt;I just try it with the scripts bellow:&lt;/P&gt;&lt;P&gt;DBCC TRACEON (3604) DBCC TRACEON (1204) &lt;/P&gt;&lt;P&gt;GO&lt;/P&gt;&lt;P&gt;begin transaction   select top 1000000 cod_p   from p (tablockx)&lt;/P&gt;&lt;P&gt;   select top 1000000 p.cod_p,d.cod_d   from p (tablockx)   join d (tablockx) on d.cod_d=p.cod_p&lt;/P&gt;&lt;P&gt;commit&lt;/P&gt;&lt;P&gt;DBCC TRACEON (3604) DBCC TRACEON (1204) &lt;/P&gt;&lt;P&gt;GO&lt;/P&gt;&lt;P&gt;begin transaction   select top 1000000 cod_d   from d (tablockx)&lt;/P&gt;&lt;P&gt;   select top 1000000 p.cod_p,d.cod_d   from p (tablockx)   join d (tablockx) on d.cod_d=p.cod_p&lt;/P&gt;&lt;P&gt;commit&lt;/P&gt;&lt;P&gt;I opnend 2 querys at query analyzer. I succeded to create a deadlock but its dont writed to error log.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Jean, i need some help at lock timeout and deadlock.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description><pubDate>Fri, 08 Oct 2004 11:31:00 GMT</pubDate><dc:creator>jean b</dc:creator></item><item><title>Tracing Deadlocks</title><link>http://www.sqlservercentral.com/Forums/Topic109787-165-1.aspx</link><description>Comments posted to this topic are about the content posted at &lt;A HREF=http://www.sqlservercentral.com/columnists/skumar/tracingdeadlocks.asp&gt;http://www.sqlservercentral.com/columnists/skumar/tracingde</description><pubDate>Sun, 04 Apr 2004 06:53:00 GMT</pubDate><dc:creator>sivakumar-135209</dc:creator></item></channel></rss>