<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx</link><description>A deadlock is a circular blocking chain, where two or more threads are each blocked by the other so that no one can proceed. When the deadlock monitor thread in SQL Server detects a circular blocking chain, it selects one of the participants as a victim,</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#749641</link><pubDate>Mon, 11 Sep 2006 19:21:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:749641</guid><dc:creator>ice9</dc:creator><description>Great Article, Can you recommend me some tips to solve a deadlock problem?&lt;br&gt;I have a Master Stored Procedure, which internally calls other procedures as needed. This master proc is invoked from a Web Application (ASPX). Sporadically I get error messages &lt;br&gt;Error Detail: System.Data.SqlClient.SqlException: Transaction (Process ID 60) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.&lt;br&gt; &amp;nbsp; at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)&lt;br&gt; &amp;nbsp; at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()&lt;br&gt;&lt;br&gt;1. How do detect where the problem is...means which section of the code is causing deadlock?&lt;br&gt;2. How should I rectify them?&lt;br&gt;&lt;br&gt;?Should I wrap the master proc with begin end tran..(since its a very high called proc I left it intially)&lt;br&gt;?Should I wrap my internal procs with tran blocks?&lt;br&gt;&lt;br&gt;TIA</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#749659</link><pubDate>Mon, 11 Sep 2006 19:36:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:749659</guid><dc:creator>bartd</dc:creator><description>&amp;gt; 1. How do detect where the problem is...means which section of the code is causing deadlock? &lt;br&gt;&lt;br&gt;This is discussed in steps 1-3 in the post. &amp;nbsp;To recap that info: If you're on SQL 2005, turn on -T1222. &amp;nbsp;This will tell you the final 2 statements involved in the deadlock. &amp;nbsp;If you're on SQL 2000, turn on -T1204 and -T3605 and capture a profiler trace that includes the SP:StmtStarting, Lock:Deadlock, and Exception events (at a minimum). &amp;nbsp;&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt; 2. How should I rectify them? &lt;br&gt;Once you identify the queries involved in the deadlock, follow steps 4-8 in the post. &amp;nbsp;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#869274</link><pubDate>Tue, 24 Oct 2006 19:33:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:869274</guid><dc:creator>rogerlin</dc:creator><description>&lt;p&gt;Hi Bart,&lt;/p&gt;
&lt;p&gt;In the decoding process, you idetify one as conflicting Update lock, another one you just call Update lock. What's the difference between a conflicting lock and a ordinary lock? Does the trace flag 1222 deadlock graph provide the detail so we would know which one is a conflicting lock and which is not? Does it makes a difference when a lock is conflicting or not?&lt;/p&gt;
&lt;p&gt;Thanks a lot,&lt;/p&gt;
&lt;p&gt;Roger &lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#869832</link><pubDate>Tue, 24 Oct 2006 20:20:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:869832</guid><dc:creator>bartd</dc:creator><description>&lt;p&gt;Roger, &lt;/p&gt;
&lt;p&gt;By &amp;quot;conflicting&amp;quot; I simply meant that that the existing lock was incompatible with the new lock request. &amp;nbsp;&amp;quot;Conflicting lock&amp;quot; == blocking lock. &amp;nbsp;That's just my word choice, not a technical term. &amp;nbsp;If two lock requests are compatible (e.g. two shared locks), they will both be granted. &amp;nbsp;If the two requests conflict, one will be blocked and the other granted. &lt;/p&gt;
&lt;p&gt;The 1222 output does identify which lock requests have been granted (&amp;lt;owner-list&amp;gt;) and which are blocked (&amp;lt;waiter-list&amp;gt;). &lt;/p&gt;
&lt;p&gt;Bart&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#1069778</link><pubDate>Mon, 13 Nov 2006 20:34:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1069778</guid><dc:creator>serhat</dc:creator><description>&lt;P&gt;Thanks so much for the info... It helped me tremendously especially when I was trying to repeat the problem. FYI: my problem was related with indexes. We have a legacy app with stored procedures updating the same row for different purposes. And one of &amp;nbsp;the columns being updated has also a non-clustered index. &amp;nbsp;I open 2 query analyser and put while 1=1 to run 2 SPs and then Boom, I get the error in either fex seconds or 20 seconds. the only time I don't get an error iswhenI remove all the indexes which is not an option. Btw, this table doesn't have a primary key... I know I know.... It wasn't me who created and that person is no longer with the company... :) But I have to fix it. &lt;/P&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#1276847</link><pubDate>Wed, 13 Dec 2006 22:36:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1276847</guid><dc:creator>sqlminds</dc:creator><description>&lt;P&gt;Check the Companion tool at www.sqlminds.com &amp;nbsp;It will do for you all of the above steps and more. For example, if you have 3 or 4 SIDs deadlocking and each SIDs has multiple statements per DB transaction, the above approach will fail since it will report ONLY the statements, which deadlocked:&lt;/P&gt;
&lt;P&gt;SID1 - begin tran update t1 ... where PK = 1&lt;/P&gt;
&lt;P&gt;SID2 - begin tran update t1 ... where PK = 2&lt;/P&gt;
&lt;P&gt;SID3 - begin tran update t1 ... where PK = 3&lt;/P&gt;
&lt;P&gt;then&lt;/P&gt;
&lt;P&gt;SID1 - select * from t1 where PK = 3 &lt;/P&gt;
&lt;P&gt;SID2 - select * from t1 where PK = 1&lt;/P&gt;
&lt;P&gt;SID3 - select * from t1 where PK = 2 &lt;/P&gt;
&lt;P&gt;This is where the deadlock monitor (spid=4) will kick in and guess what, you'll be getting the last three statements in the output &lt;/P&gt;
&lt;P&gt;SID1 - select * from t1 where PK = 3 &lt;/P&gt;
&lt;P&gt;SID2 - select * from t1 where PK = 1&lt;/P&gt;
&lt;P&gt;SID3 - select * from t1 where PK = 2&lt;/P&gt;
&lt;P&gt;I don't think you can figure out the deadlock given only these three statements. &amp;nbsp;You can do some tedious digging into the outstanding locks and figure out the deadlock but this can be done with the assumption that you know intimately your statements (i.e. what if you are an ASP - App service provider...). &amp;nbsp;Check out the tool I've mentioned; it will give you the blocking chain PLUS the timing. &amp;nbsp;HTH&lt;/P&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#1323162</link><pubDate>Tue, 19 Dec 2006 09:52:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1323162</guid><dc:creator>bartd</dc:creator><description>&lt;p&gt;The tool you describe sounds pretty cool. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;FWIW, step 8 in the instructions above mentions that a profiler trace may be necessary if one or more of the deadlock participants are involved in a multi-batch transaction. &amp;nbsp;&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#1402162</link><pubDate>Wed, 03 Jan 2007 09:59:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1402162</guid><dc:creator>Tushar</dc:creator><description>&lt;p&gt;is it possible to cause a deadlock by 2 &amp;nbsp;&amp;quot;select&amp;quot; staments?&lt;/p&gt;
&lt;p&gt;tnks &amp;nbsp;a lot for any help !&lt;/p&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#1405154</link><pubDate>Wed, 03 Jan 2007 19:31:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1405154</guid><dc:creator>bartd</dc:creator><description>&lt;P&gt;Possibly. &amp;nbsp;One such case would be if the SELECT statements used a hint to change the type of locks being acquired (e.g. UPDLOCK, XLOCK). &amp;nbsp;You could also see this if the SELECT statements were part of a multi-statement transaction. &amp;nbsp;For example, these two transactions could deadlock on the SELECT statements: &lt;/P&gt;
&lt;P&gt;&amp;nbsp; Connection 1:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;begin tran&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;update t1 set ... where c1 = x&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;select * from t1 where c1 = y&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Connection 2:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;begin tran&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;update t1 set ... where c1 = y&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;select * from t1 where c1 = x&lt;/P&gt;
&lt;P&gt;Troubleshoot these just as you would any other deadlock. &lt;/P&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#1630755</link><pubDate>Fri, 09 Feb 2007 03:58:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1630755</guid><dc:creator>Prasanna Prabhu</dc:creator><description>&lt;p&gt;In the text above, on point #2 you have highlighted the TEXT with YELLOW back-ground, which is really cool.&lt;/p&gt;
&lt;p&gt;Will this feature (text with Yellow back-ground) be available out-of-box, if it can be, then it will be really cool&lt;/p&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#1773836</link><pubDate>Wed, 28 Feb 2007 16:03:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1773836</guid><dc:creator>bartd</dc:creator><description>&lt;p&gt;Prasanna, &lt;/p&gt;
&lt;p&gt;No, the SQL errorlog is just a plain text file; the yellow text highlighting is my emphasis. &amp;nbsp;I did it to call out some of the data points in the 1222 output that can be the most useful when trying to understand a deadlock. &amp;nbsp;You'll have to locate these data points in your own -T1222 output yourself. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Bart&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#1957487</link><pubDate>Tue, 27 Mar 2007 05:19:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1957487</guid><dc:creator>Dmitrey</dc:creator><description>&lt;p&gt; Hi Bart thanks for your post, very helpful. &amp;nbsp;I have read through your Decoding_T1204_Output.htm and have a small question. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;You:&lt;/p&gt;
&lt;p&gt;Spid 52 is running a DELETE statement on line 6 of the stored proc spClearItemStatus. &amp;nbsp;He holds an X lock on the key resource KEY: 7:2121058592:2 (a70064fb1eac). &amp;nbsp;This lock is blocking spid 52, who is waiting to acquire a U lock on the same key. &lt;/p&gt;
&lt;p&gt;Q: Should it say: This lock is blocking spid 51, instead?&lt;/p&gt;
&lt;p&gt;You:&lt;/p&gt;
&lt;p&gt;Spid 51 is running an UPDATE statement on line 47 of the stored proc spUpdateItemProp. &amp;nbsp;He holds an X lock on key KEY: 7:1977058079:1 (02014f0bec4e). &amp;nbsp;His X lock is blocking spid 51, who is waiting to acquire an X lock on the same key. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Q: Should it say: This lock is blocking spid 52, instead?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Dmitrey&lt;/p&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#1980075</link><pubDate>Wed, 28 Mar 2007 23:13:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1980075</guid><dc:creator>bartd</dc:creator><description>&lt;p&gt;Dmitrey, &lt;/p&gt;
&lt;p&gt;You're absolutely right -- those were errors. &amp;nbsp;I've fixed them in HTM file attached to the post. &lt;/p&gt;
&lt;p&gt;Thanks! &lt;/p&gt;
&lt;p&gt;Bart&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#2076689</link><pubDate>Tue, 10 Apr 2007 22:49:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2076689</guid><dc:creator>Bill</dc:creator><description>&lt;p&gt;Hi, Bart&lt;/p&gt;
&lt;p&gt;Which profiler event(s) should I capture? I use Deadlock Graph and Blocked Process Report, are there others?&lt;/p&gt;
&lt;p&gt;Thank you,&lt;/p&gt;
&lt;p&gt;Bill&lt;/p&gt;
&lt;p&gt;If one or both spids is running a multi-statement transaction, you may need to capture a profiler trace that spans the deadlock in order to identify the full set of queries that were involved in the deadlock. &amp;nbsp;Unfortunately, both -T1204 and -T1222 only print out the two queries that “closed the loop”, and it’s possible that one of the blocking locks was acquired by an earlier query run within the same transaction. &lt;/p&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#2078610</link><pubDate>Wed, 11 Apr 2007 02:11:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2078610</guid><dc:creator>Bill</dc:creator><description>&lt;p&gt;Hi, &lt;/p&gt;
&lt;p&gt;Which profiler events capture such scenario?&lt;/p&gt;
&lt;p&gt;If one or both spids is running a multi-statement transaction, you may need to capture a profiler trace that spans the deadlock in order to identify the full set of queries that were involved in the deadlock. &amp;nbsp;Unfortunately, both -T1204 and -T1222 only print out the two queries that “closed the loop”, and it’s possible that one of the blocking locks was acquired by an earlier query run within the same transaction. &lt;/p&gt;
&lt;p&gt;Bill&lt;/p&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#2102857</link><pubDate>Thu, 12 Apr 2007 22:18:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2102857</guid><dc:creator>bartd</dc:creator><description>&lt;p&gt;Bill, &lt;/p&gt;
&lt;p&gt;Capture RPC:Starting/Completed, SQL:BatchStarting/Completed, and SQLTransaction at minimum. &amp;nbsp;If possible without introducing undue load on the server, add SQL:StmtStarting, RPC:StmtStarting, and a pre-execution showplan event like Showplan All/Showplan XML. &amp;nbsp;-T1222 will tell you what resources (including table names) were involved in the deadlock. &amp;nbsp;Those profiler events will tell you what tables were modified within the participating spids' transactions. &amp;nbsp;Taken together, trace flag 1222 and the profiler trace should allow you to figure out which queries acquired the locks that were involved in the deadlock. &lt;/p&gt;
&lt;p&gt;HTH, &lt;/p&gt;
&lt;p&gt;Bart&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#2106900</link><pubDate>Fri, 13 Apr 2007 04:03:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2106900</guid><dc:creator>Bill</dc:creator><description>&lt;p&gt;Hi, Bart&lt;/p&gt;
&lt;p&gt;Can you give me an example of more about the statement below and why Deadlock Graph\-T1222 can not accomplish? I guess i stll dont understand..&lt;/p&gt;
&lt;p&gt;If one or both spids is running a multi-statement transaction, you may need to capture a profiler trace that spans the deadlock in order to identify the full set of queries that were involved in the deadlock. &amp;nbsp;Unfortunately, both -T1204 and -T1222 only print out the two queries that “closed the loop”, and it’s possible that one of the blocking locks was acquired by an earlier query run within the same transaction. &lt;/p&gt;
&lt;p&gt;Thank you,&lt;/p&gt;
&lt;p&gt;Bill&lt;/p&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#2147491</link><pubDate>Mon, 16 Apr 2007 01:17:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2147491</guid><dc:creator>bartd</dc:creator><description>&lt;p&gt;Bill, &lt;/p&gt;
&lt;p&gt;Consider the simple deadlock scenario described at the beginning of &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/bartd/archive/2006/09/25/deadlock-troubleshooting-part-3.aspx"&gt;http://blogs.msdn.com/bartd/archive/2006/09/25/deadlock-troubleshooting-part-3.aspx&lt;/a&gt;. &amp;nbsp;In a case like this, only query #3 would be shown in the -T1222 (or -T1204) output. &amp;nbsp;You would need a profiler trace if you wanted to see query #2 for each transaction, which played an important role in the deadlock. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;HTH, &lt;/p&gt;
&lt;p&gt;Bart&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#2165916</link><pubDate>Tue, 17 Apr 2007 22:51:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2165916</guid><dc:creator>Anders</dc:creator><description>&lt;p&gt;Is there a reason why adding the &amp;quot;Lock:Deadlock graph&amp;quot; event class will not generate the event when the Lock:Deadlock event is recorded?&lt;/p&gt;
&lt;p&gt;In addition, the -T1222 output is indicating two different resources for a RID lock (names have been changed to protect the innocent :O). &amp;nbsp;Why would it deadlock on statements in two different tables?&lt;/p&gt;
&lt;p&gt;ridlock fileid=1 pageid=1711 dbid=5 objectname=db.dbo.t1 id=lock39ebac0 mode=X associatedObjectId=72057594039959552&lt;/p&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;p&gt;ridlock fileid=1 pageid=2097 dbid=5 objectname=db.dbo.t2 id=lock39eaec0 mode=X associatedObjectId=72057594040811520&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Anders&lt;/p&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#2234864</link><pubDate>Sun, 22 Apr 2007 21:58:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2234864</guid><dc:creator>bartd</dc:creator><description>&lt;p&gt;Anders: &lt;/p&gt;
&lt;p&gt;&amp;gt; “Is there a reason why adding the &amp;quot;Lock:Deadlock graph&amp;quot; event class will not generate the event when the Lock:Deadlock event is recorded?”&lt;/p&gt;
&lt;p&gt;Sorry, could you clarify this question? &amp;nbsp;Capturing the &amp;quot;Lock:Deadlock Graph” event in a profiler trace will provide the same information that you can get in the errorlog via -T1222. &amp;nbsp;To see the raw XML instead of the graphical view of the deadlock that the profiler GUI shows, right-click on the event and select “Extract event data”. &amp;nbsp;(The graphical view is pretty and easier to understand, but it is also only provides a subset of the information that is available in the raw XML.) &amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;gt; “In addition, the -T1222 output is indicating two different resources for a RID lock (names have been changed to protect the innocent :O). &amp;nbsp;Why would it deadlock on statements in two different tables?”&lt;/p&gt;
&lt;p&gt;Every deadlock must involve a minimum of two *different* lock resources. &amp;nbsp;Each resource is owned by one of the deadlock participants. &amp;nbsp;Each deadlock participant is blocked, waiting to get access to the resource currently locked by the other participant. &amp;nbsp;That’s the way deadlocks work; if only one lock resource was involved, it could only be a simple blocking incident, not a deadlock. &amp;nbsp;&lt;/p&gt;
</description></item><item><title>Bart Duncan's SQL Weblog : Deadlock Troubleshooting, Part 3</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#2361532</link><pubDate>Tue, 01 May 2007 22:08:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2361532</guid><dc:creator>Bart Duncan's SQL Weblog : Deadlock Troubleshooting, Part 3</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/bartd/archive/2006/09/25/deadlock-troubleshooting-part-3.aspx"&gt;http://blogs.msdn.com/bartd/archive/2006/09/25/deadlock-troubleshooting-part-3.aspx&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#2552264</link><pubDate>Fri, 11 May 2007 23:16:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2552264</guid><dc:creator>adam.bean</dc:creator><description>&lt;p&gt;Hello Bart,&lt;/p&gt;
&lt;p&gt;Great article, best I've read on 2005 deadlocking thus far. I've always used the -T1204 and -T3605 in 2000. I was getting ready to add these to our new 2005 servers when I thought I should look for an update ... low and behold there is.&lt;/p&gt;
&lt;p&gt;I've added the -T1222 via config manager, restarted, and created a deadlock (&lt;a rel="nofollow" target="_new" href="http://wardyit.com/blog/blog/archive/2005/12/12/65.aspx"&gt;http://wardyit.com/blog/blog/archive/2005/12/12/65.aspx&lt;/a&gt;) yet I see no messages in my eventviewer nor displayed on screen ... just the deadlock error itself.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#2552614</link><pubDate>Fri, 11 May 2007 23:36:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2552614</guid><dc:creator>bartd</dc:creator><description>&lt;p&gt;Adam, &lt;/p&gt;
&lt;p&gt;Did you enable the trace flag via DBCC TRACEON, or as a server startup parameter? &amp;nbsp;If you enabled it as a server startup param, did you bounce the SQL service? &amp;nbsp;If you enabled it via DBCC TRACEON, be sure that you set it as a global trace flag (note the &amp;quot;-1&amp;quot; in &amp;quot;DBCC TRACEON (1222, -1)&amp;quot;). &amp;nbsp;The trace flag infrastructure is implemented completely differently in SQL 2005, so there are certain trace flags that now must be enabled globally when a simple &amp;quot;DBCC TRACEON (flag)&amp;quot; would suffice in SQL 2000. &amp;nbsp;That might be worth a blog post someday... &lt;/p&gt;
&lt;p&gt;If you're pretty sure that this is what you did, run &amp;quot;DBCC TRACESTATUS (-1)&amp;quot;. &amp;nbsp;If the trace flag is set correctly, you'll see 1222 in the list of enabled trace flags, and the &amp;quot;Global&amp;quot; column will be set to 1. &amp;nbsp;If 1222 shows up in the list but the Global column is set to 0, you set the trace flag at the session level (meaning only for your spid -- it won't apply to the deadlock monitor thread, which is the only spid that can spew -T1222 to the errorlog). &amp;nbsp;&lt;/p&gt;
&lt;p&gt;If the trace flag is definitely set globally, recreate your deadlock, wait for it to be detected and resolved, then run &amp;quot;sp_readerrorlog&amp;quot;. &amp;nbsp;You should see the -T1222 output near the end of the log (search for the text &amp;quot;deadlock&amp;quot;). &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Hope this helps, &lt;/p&gt;
&lt;p&gt;Bart&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#2553097</link><pubDate>Sat, 12 May 2007 00:05:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2553097</guid><dc:creator>adam.bean</dc:creator><description>&lt;p&gt;Thanks for the fast reply Bart.&lt;/p&gt;
&lt;p&gt;Yeah I added it via the gui (Config Manager) -T1222; at the end of the startup parameters. Restarted SQL afterwards and still not seeing any information in the error log.&lt;/p&gt;
&lt;p&gt;Running DBCC TRACESTATUS (-1) returns nothing but completed successfully.&lt;/p&gt;
&lt;p&gt;I don't like the new config manager ... what here is wrong?&lt;/p&gt;
&lt;p&gt;-dC:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\master.mdf;-eC:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG;-lC:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\mastlog.ldf; -T1222&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#2556204</link><pubDate>Sat, 12 May 2007 03:00:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2556204</guid><dc:creator>bartd</dc:creator><description>&lt;p&gt;Try bypassing the config manager GUI and peeking in the registry: &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\Parameters&lt;/p&gt;
&lt;p&gt;You should have a &amp;quot;SQLArg3&amp;quot; value there with the data &amp;quot;-T1222&amp;quot;. &amp;nbsp;If it seems to be in order, is there any chance that you copied and pasted the text &amp;quot;-T1222&amp;quot; when you added the param originally? &amp;nbsp;Word and some other editors have an annoying habit of replacing a normal ASCII dash &amp;quot;-&amp;quot; character with a long dash. &amp;nbsp;Visually, the long dash is very difficult to differentiate from the ASCII dash, but it is sufficient to make SQL unable to understand the command line param. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Just a guess... If this is a possibile explanation, edit the value in regedit, re-type the string, then bounce SQL so it will re-read that reg key. &amp;nbsp;In the short-term you can enable the trace flag temporarily by running &amp;quot;DBCC TRACEON (1222, -1)&amp;quot;, just don't forget the -1. &amp;nbsp;But it should work to add the trace flag as a SqlArg -- SQL wouldn't be able to start at all if it couldn't read the params listed in that reg key, as it is the only way the server can find out where the master database lives. &lt;/p&gt;
&lt;p&gt;HTH, &lt;/p&gt;
&lt;p&gt;Bart&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#2773504</link><pubDate>Mon, 21 May 2007 22:54:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2773504</guid><dc:creator>adam.bean</dc:creator><description>&lt;p&gt;Just wanted to follow up and say I got it working ... I had an extra space before the -T1222 flag! &lt;/p&gt;
&lt;p&gt;Anyways, thanks for the help and this useful information.&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#3111817</link><pubDate>Wed, 06 Jun 2007 10:37:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3111817</guid><dc:creator>Shagun</dc:creator><description>&lt;p&gt;Hi Bart,&lt;/p&gt;
&lt;p&gt;I'll really appreciate if you can interpret following deadlock graph on SQL Server 2000&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.21 spid4 &amp;nbsp; &amp;nbsp; Node:1&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.21 spid4 &amp;nbsp; &amp;nbsp; KEY: 8:1358627883:2 (9e045f9bca23) CleanCnt:2 Mode: Range-S-S Flags: 0x0&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.21 spid4 &amp;nbsp; &amp;nbsp; &amp;nbsp;Grant List 0::&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.22 spid4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Owner:0x42cd4160 Mode: Range-S-S Flg:0x0 Ref:1 Life:02000000 SPID:139 ECID:0&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.24 spid4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SPID: 139 ECID: 0 Statement Type: INSERT Line #: 1&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.24 spid4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Input Buf: RPC Event: sp_execute;1&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.24 spid4 &amp;nbsp; &amp;nbsp; &amp;nbsp;Grant List 1::&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.24 spid4 &amp;nbsp; &amp;nbsp; &amp;nbsp;Requested By: &lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.26 spid4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ResType:LockOwner Stype:'OR' Mode: Range-Insert-Null SPID:138 ECID:0 Ec:(0x44843508) Value:0x42cdce40 Cost:(0/24D0)&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.29 spid4 &amp;nbsp; &amp;nbsp; &lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.35 spid4 &amp;nbsp; &amp;nbsp; Node:2&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.35 spid4 &amp;nbsp; &amp;nbsp; KEY: 8:1358627883:2 (9e045f9bca23) CleanCnt:2 Mode: Range-S-S Flags: 0x0&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.37 spid4 &amp;nbsp; &amp;nbsp; &amp;nbsp;Grant List 0::&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.37 spid4 &amp;nbsp; &amp;nbsp; &amp;nbsp;Grant List 1::&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.37 spid4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Owner:0x42cddc60 Mode: Range-S-S Flg:0x0 Ref:1 Life:02000000 SPID:138 ECID:0&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.38 spid4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SPID: 138 ECID: 0 Statement Type: INSERT Line #: 1&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.43 spid4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Input Buf: RPC Event: sp_execute;1&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.43 spid4 &amp;nbsp; &amp;nbsp; &amp;nbsp;Requested By: &lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.57 spid4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ResType:LockOwner Stype:'OR' Mode: Range-Insert-Null SPID:139 ECID:0 Ec:(0x4469F508) Value:0x42cd41e0 Cost:(0/166C)&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.68 spid4 &amp;nbsp; &amp;nbsp; Victim Resource Owner:&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:32.68 spid4 &amp;nbsp; &amp;nbsp; &amp;nbsp;ResType:LockOwner Stype:'OR' Mode: Range-Insert-Null SPID:139 ECID:0 Ec:(0x4469F508) Value:0x42cd41e0 Cost:(0/166C)&lt;/p&gt;
&lt;p&gt;2007-06-04 16:28:42.80 spid4 &amp;nbsp; &amp;nbsp; &lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;-Shagun&lt;/p&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#4029086</link><pubDate>Tue, 24 Jul 2007 18:01:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4029086</guid><dc:creator>Bas Vedder</dc:creator><description>&lt;p&gt;Wondering if someone can explain the following:&lt;/p&gt;
&lt;p&gt;Create a table with no indexes, an Identity column (int), two varchar(50) columns and one smallint column.&lt;/p&gt;
&lt;p&gt;The last three columns all nullable.&lt;/p&gt;
&lt;p&gt;Enter two rows with values. Now in two Query windows execute the following:&lt;/p&gt;
&lt;p&gt;1) &amp;nbsp; BEGIN TRAN&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;SELECT * FROM TestRowID WITH (UPDLOCK)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;WHERE ID = 1&lt;/p&gt;
&lt;p&gt;2) &amp;nbsp; BEGIN TRAN&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;SELECT * FROM TestRowID WITH (UPDLOCK)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;WHERE ID = 2&lt;/p&gt;
&lt;p&gt;The statement in the second is blocked by the first statement....&lt;/p&gt;
&lt;p&gt;If we look at the activity monitor in SQL 2005 we for :&lt;/p&gt;
&lt;p&gt;1) &amp;nbsp; DATABASE &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; S Lock &amp;nbsp; Granted&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;OBJECT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2073058421 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IX Lock &amp;nbsp; Granted&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;PAGE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 72057594038321152 &amp;nbsp; IU Lock &amp;nbsp; Granted &amp;nbsp; 1:154&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;RID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;72057594038321152 &amp;nbsp; U Lock &amp;nbsp; &amp;nbsp;Granted &amp;nbsp; 1:154:0&lt;/p&gt;
&lt;p&gt;2) &amp;nbsp; DATABASE &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; S Lock &amp;nbsp; Granted&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;OBJECT &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2073058421 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IX Lock &amp;nbsp; Granted&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;PAGE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 72057594038321152 &amp;nbsp; IU Lock &amp;nbsp; Granted &amp;nbsp; 1:154&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;RID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;72057594038321152 &amp;nbsp; U Lock &amp;nbsp; &amp;nbsp;Wait &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1:154:0&lt;/p&gt;
&lt;p&gt;Object 2073058421 is the table in question.&lt;/p&gt;
&lt;p&gt;Now the question is, why is the second window trying to take out an U lock on RID 0?&lt;/p&gt;
&lt;p&gt;It should lock another row, right?&lt;/p&gt;
&lt;p&gt;Even when we introduce an non-clustered index on the ID Column, the same issue still occurs.&lt;/p&gt;
&lt;p&gt;The database is SQL Server 2005 SP 2, but the same is observed on SQL 2000. However, introducing an&lt;/p&gt;
&lt;p&gt;index on SQL 2000 does remove the blocking behaviour....&lt;/p&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#4503042</link><pubDate>Wed, 22 Aug 2007 05:58:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4503042</guid><dc:creator>bartd</dc:creator><description>&lt;p&gt;Bas, because there is no index on the table, SQL must visit and evaluate every row to see if it needs to be updated. &amp;nbsp;Because the row might be updated, SQL must acquire an Update lock on each row as part of this evaluation (to prevent a common type of deadlock). &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Your first transaction acquires and holds a lock on a row that is incompatible with the Update lock that the second transaction will acquire. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Creating an index might avoid the blocking if SQL chooses to use it. &amp;nbsp;However, SQL may choose to use a table scan if (as in your example) the number of rows in the table is very small (or the percentage of the table that the QO estimates it will need to be update is large). &amp;nbsp;If SQL chooses to scan the table despite the presence of an index, you will still see the same locking behavior. &amp;nbsp;The fundamental rules of governing this decision haven't changed in SQL 2005, but there are subtle changes in the costing of possible plans in different versions of SQL that could cause a scan to be costed as slightly cheaper on one version and a seek to be costed as a bit cheaper on a different version. &amp;nbsp;&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#5300627</link><pubDate>Sat, 06 Oct 2007 00:08:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5300627</guid><dc:creator>Mpls Mike</dc:creator><description>&lt;p&gt;Bart,&lt;/p&gt;
&lt;p&gt;Great post! &amp;nbsp;&lt;/p&gt;
&lt;p&gt;What are your thoughts on using &amp;nbsp;SET CONTEXT_INFO (or sp_bindsession) ? &amp;nbsp;I have an ETL process that has frequent deadlocks, even though the data is strictly partitioned - doesn't overlap. &amp;nbsp;Don't want index maint on loading/transforming, and when disabled page locks, the process slowed down tremendously.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#5333078</link><pubDate>Sun, 07 Oct 2007 09:05:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5333078</guid><dc:creator>bartd</dc:creator><description>&lt;p&gt;Mike, &lt;/p&gt;
&lt;p&gt;I don't think CONTEXT_INFO will help you with your deadlocks. &amp;nbsp;In theory, sp_gettoken/sp_bindsession could prevent a deadlock, assuming that (a) it is appropriate for the two processes involved in the deadlock to share a single transaction, and (b) you are able to make some non-trivial changes to one of the apps to have it enlist in the other app's transaction. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Unless your deadlock involves two connections that are doing different pieces of the same ETL transformation, I doubt (a) would apply to you. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I'm not clear on the details of your situation. &amp;nbsp;Are you trying to load a table that has no indexes while other processes concurrently access the table? &amp;nbsp;If so, this is a recipe for blocking. &amp;nbsp;Any read or modification to a table without indexes will require a table scan, which of course means locking every page or row in the table. &amp;nbsp;That all but guarantees that any query that runs at the same time as your ETL data load will be involved in some sort of blocking. &amp;nbsp;It also means that you are probably getting terrible query plans. &lt;/p&gt;
&lt;p&gt;If that isn't your situation, please share some specifics. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Bart&lt;/p&gt;
</description></item><item><title>Best SQL server deadlock debugging instructions ever</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#5453865</link><pubDate>Sun, 14 Oct 2007 23:45:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5453865</guid><dc:creator>DotNetKicks.com</dc:creator><description>&lt;p&gt;You've been kicked (a good thing) - Trackback from DotNetKicks.com&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#5468166</link><pubDate>Tue, 16 Oct 2007 10:37:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5468166</guid><dc:creator>Bas Vedder</dc:creator><description>&lt;p&gt;Thanks Bart.&lt;/p&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#6181017</link><pubDate>Tue, 13 Nov 2007 22:27:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6181017</guid><dc:creator>adam.bean</dc:creator><description>&lt;p&gt;Bart,&lt;/p&gt;
&lt;p&gt;Do you have some time you'd be able to look over some deadlocks we've been having? I've been using your page as a bible and I'm still coming up a bit short ... If you are able to give me a few minutes, I'd really appreciate it. My email is in my bio.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#6309713</link><pubDate>Fri, 16 Nov 2007 21:02:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6309713</guid><dc:creator>Mpls Mike</dc:creator><description>&lt;p&gt;Bart,&lt;/p&gt;
&lt;p&gt;The bindsession (context_info) method worked like a charm. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I had also tried disabling page locks, suspecting lock escalation, which did reduce the deadlocks, but not eliminate completely. &amp;nbsp;The processing time increased enormously. &amp;nbsp;Yuk.&lt;/p&gt;
&lt;p&gt;Is there any chance we could get you to visit and present at the PASS-MN (Minneapolis) group in the future?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;</description></item><item><title>Not published yet</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#7220808</link><pubDate>Thu, 24 Jan 2008 15:13:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7220808</guid><dc:creator>Andrew Calvett</dc:creator><description>&lt;p&gt;Firstly I must say a big thank you to Microsoft for the new deadlock trace flag 1222. Compared to the...&lt;/p&gt;
</description></item><item><title>SSMS Log file viewer and Deadlock Graphs</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#7220809</link><pubDate>Thu, 24 Jan 2008 15:13:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7220809</guid><dc:creator>Andrew Calvett</dc:creator><description>&lt;p&gt;Firstly I must say a big thank you to Microsoft for the new deadlock trace flag 1222. Compared to the&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#8902983</link><pubDate>Thu, 28 Aug 2008 10:07:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8902983</guid><dc:creator>Rony</dc:creator><description>&lt;P&gt;Hi bart,&lt;/P&gt;
&lt;P&gt;i've been experiencing alot of deadlock with type 'pagelock' such this :&lt;/P&gt;
&lt;P&gt;update KMS_SERV_MAST_REC set ACTION_CODE= @P0 , ACTV_GRP_ID= @P1 , ACTV_ID= @P2 , STAFF_ID= @P3 , ICD_CODE= @P4 , ICD_CODE_2= @P5 , ICD_CODE_3= @P6 , ICD_CODE_4= @P7 , ICD_CODE_5= @P8 , CREATED_BY= @P9 , CREATED_DATE= @P10 , LAST_UPD_BY= @P11 , LAST_UPD_DATE= @P12 , actual_date= @P13 , dischrg_home_addr= @P14 , dischrg_summary_notes= @P15 , dischrg_summary_given= @P16 , dismissal_code= @P17 , amendment_type= @P18 , amendment_note= @P19 &amp;nbsp;where MR_NO= @P20 &amp;nbsp;and MR_DATE= @P21 &amp;nbsp;and MR_TYPE= @P22 &amp;nbsp;and MR_SEQ= @P23 &amp;nbsp; &amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inputbuf&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; (@P0 nvarchar(4000),@P1 bigint,@P2 int,@P3 nvarchar(4000),@P4 nvarchar(4000),@P5 nvarchar(4000),@P6 nvarchar(4000),@P7 nvarchar(4000),@P8 nvarchar(4000),@P9 nvarchar(4000),@P10 datetime,@P11 nvarchar(4000),@P12 datetime,@P13 datetime,@P14 nvarchar(4000),@P15 nvarchar(4000),@P16 nvarchar(4000),@P17 nvarchar(4000),@P18 nvarchar(4000),@P19 nvarchar(4000),@P20 nvarchar(4000),@P21 datetime,@P22 nvarchar(4000),@P23 int)update KMS_SERV_MAST_REC set ACTION_CODE= @P0 , ACTV_GRP_ID= @P1 , ACTV_ID= @P2 , STAFF_ID= @P3 , ICD_CODE= @P4 , ICD_CODE_2= @P5 , ICD_CODE_3= @P6 , ICD_CODE_4= @P7 , ICD_CODE_5= @P8 , CREATED_BY= @P9 , CREATED_DATE= @P10 , LAST_UPD_BY= @P11 , LAST_UPD_DATE= @P12 , actual_date= @P13 , dischrg_home_addr= @P14 , dischrg_summary_notes= @P15 , dischrg_summary_given= @P16 , dismissal_code= @P17 , amendment_type= @P18 , amendment_note= @P19 &amp;nbsp;where MR_NO= @P20 &amp;nbsp;and MR_DATE= @P21 &amp;nbsp;and MR_TYPE= @P22 &amp;nbsp;and MR_SEQ= @P23 &amp;nbsp; &amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;process id=processbc44d8 taskpriority=0 logused=0 waitresource=PAGE: 5:1:26310 waittime=687 ownerId=53109491 transactionname=implicit_transaction lasttranstarted=2008-07-03T11:07:22.770 XDES=0x3d7ebe8 lockMode=U schedulerid=4 kpid=4964 status=suspended spid=59 sbid=0 ecid=0 priority=0 transcount=2 lastbatchstarted=2008-07-03T11:07:22.787 lastbatchcompleted=2008-07-03T11:07:22.787 clientapp=jTDS hostname=GRSMED1 hostpid=123 loginname=kmsappl isolationlevel=read committed (2) xactid=53109491 currentdb=5 lockTimeout=4294967295 clientoption1=671088672 clientoption2=128058&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; executionStack&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;frame procname=adhoc line=1 stmtstart=834 sqlhandle=0x02000000531ade3a7674bac5a6157116168d0d92c2150219&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; update KMS_SERV_MAST_REC set ACTION_CODE= @P0 , ACTV_GRP_ID= @P1 , ACTV_ID= @P2 , STAFF_ID= @P3 , ICD_CODE= @P4 , ICD_CODE_2= @P5 , ICD_CODE_3= @P6 , ICD_CODE_4= @P7 , ICD_CODE_5= @P8 , CREATED_BY= @P9 , CREATED_DATE= @P10 , LAST_UPD_BY= @P11 , LAST_UPD_DATE= @P12 , actual_date= @P13 , dischrg_home_addr= @P14 , dischrg_summary_notes= @P15 , dischrg_summary_given= @P16 , dismissal_code= @P17 , amendment_type= @P18 , amendment_note= @P19 &amp;nbsp;where MR_NO= @P20 &amp;nbsp;and MR_DATE= @P21 &amp;nbsp;and MR_TYPE= @P22 &amp;nbsp;and MR_SEQ= @P23 &amp;nbsp; &amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inputbuf&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; (@P0 nvarchar(4000),@P1 bigint,@P2 int,@P3 nvarchar(4000),@P4 nvarchar(4000),@P5 nvarchar(4000),@P6 nvarchar(4000),@P7 nvarchar(4000),@P8 nvarchar(4000),@P9 nvarchar(4000),@P10 datetime,@P11 nvarchar(4000),@P12 datetime,@P13 datetime,@P14 nvarchar(4000),@P15 nvarchar(4000),@P16 nvarchar(4000),@P17 nvarchar(4000),@P18 nvarchar(4000),@P19 nvarchar(4000),@P20 nvarchar(4000),@P21 datetime,@P22 nvarchar(4000),@P23 int)update KMS_SERV_MAST_REC set ACTION_CODE= @P0 , ACTV_GRP_ID= @P1 , ACTV_ID= @P2 , STAFF_ID= @P3 , ICD_CODE= @P4 , ICD_CODE_2= @P5 , ICD_CODE_3= @P6 , ICD_CODE_4= @P7 , ICD_CODE_5= @P8 , CREATED_BY= @P9 , CREATED_DATE= @P10 , LAST_UPD_BY= @P11 , LAST_UPD_DATE= @P12 , actual_date= @P13 , dischrg_home_addr= @P14 , dischrg_summary_notes= @P15 , dischrg_summary_given= @P16 , dismissal_code= @P17 , amendment_type= @P18 , amendment_note= @P19 &amp;nbsp;where MR_NO= @P20 &amp;nbsp;and MR_DATE= @P21 &amp;nbsp;and MR_TYPE= @P22 &amp;nbsp;and MR_SEQ= @P23 &amp;nbsp; &amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; resource-list&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pagelock fileid=1 pageid=26310 dbid=5 objectname=kms30prod002.kms.KMS_SERV_MAST_REC id=lock2be86740 mode=IX associatedObjectId=72057594063421440&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; owner-list&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;owner id=process88b1f8 mode=IX&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; waiter-list&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;waiter id=processbc44d8 mode=U requestType=wait&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pagelock fileid=1 pageid=17123 dbid=5 objectname=kms30prod002.kms.KMS_SERV_MAST_REC id=lock30e08b40 mode=U associatedObjectId=72057594063421440&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; owner-list&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;owner id=processbc44d8 mode=U&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; waiter-list&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;waiter id=process88b1f8 mode=U requestType=wait&lt;/P&gt;
&lt;P&gt;Do you have any idea whats going on ?&lt;/P&gt;
&lt;P&gt;I wonder if i used ROWLOCK hint on my update statement will resolved this deadlock ?&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#8920384</link><pubDate>Tue, 02 Sep 2008 21:00:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8920384</guid><dc:creator>bartd</dc:creator><description>&lt;p&gt;Rony - &lt;/p&gt;
&lt;p&gt;Page locks are usually an indication of a table or index scan. &amp;nbsp;The best solution is probably to tune your UPDATE statement so that there is a more efficient access path to the qualifying rows. &amp;nbsp;Review the steps in this blog post; did you run the query through Database Engine Tuning Advisor? &amp;nbsp;It might have recommended a better index. &amp;nbsp;If DTA didn't make any recommendations, consider an index on MR_NO, MR_DATE, MR_TYPE, and MR_SEQ. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;HTH, &lt;/p&gt;
&lt;p&gt;Bart&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#8923367</link><pubDate>Thu, 04 Sep 2008 05:15:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8923367</guid><dc:creator>Rony</dc:creator><description>&lt;p&gt;Hi Bart,&lt;/p&gt;
&lt;p&gt;Thanks for your answer, i already run the query through database engine tuning advisor and yes DTA didnt make any recommendations, i forgot to tell you that MR_NO, MR_DATE, MR_TYPE and MR_SEQ are primary key, so all of these column is already indexed i think. &lt;/p&gt;
&lt;p&gt;Any other suggestions bart ?&lt;/p&gt;
&lt;p&gt;I'll try to see whether i can change the UPDATE statement and see if there is a more efficient acces path to the qualifying rows &lt;/p&gt;
&lt;p&gt;Rony&lt;/p&gt;</description></item><item><title>Today's Annoyingly-Unwieldy Term: "Intra-Query Parallel Thread Deadlocks"</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#8964069</link><pubDate>Wed, 24 Sep 2008 23:57:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8964069</guid><dc:creator>Bart Duncan's SQL Weblog</dc:creator><description>&lt;p&gt;I've received a couple of questions in email and in comments about deadlocks involving mysterious-sounding&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#9023934</link><pubDate>Thu, 30 Oct 2008 11:04:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9023934</guid><dc:creator>Satish</dc:creator><description>&lt;p&gt;Hi, I could no able trace dead lock information Profiler, even though there was dead lock issue happend from Application level. I turn on the trace flags 1222, 1204 using DBCC in SQL Query Analyser.&lt;/p&gt;
&lt;p&gt;Please suggest how to trace dead lock information?&lt;/p&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#9024241</link><pubDate>Thu, 30 Oct 2008 14:19:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9024241</guid><dc:creator>bartd</dc:creator><description>&lt;p&gt;Satish - &lt;/p&gt;
&lt;p&gt;1. What is the exact text of the error message you received in the application? &lt;/p&gt;
&lt;p&gt;2. What is the exact text of the DBCC command you ran to turn on the trace flags? &lt;/p&gt;
&lt;p&gt;3. Were you expecting to find the trace flag output in Profiler? &amp;nbsp;If so, re-read this article. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;4. Were the trace flags turned on at the time of the deadlock error? &amp;nbsp;They must be on *before* the deadlock occurs. &lt;/p&gt;
&lt;p&gt;5. Did you restart the SQL Server service? &amp;nbsp;A trace flag enabled via DBCC TRACEON will be turned off when you restart the service. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;6. Try running &amp;quot;DBCC TRACESTATUS (-1)&amp;quot; to see what trace flags are currently enabled. &lt;/p&gt;
&lt;p&gt;HTH - &lt;/p&gt;
&lt;p&gt;Bart&lt;/p&gt;
</description></item><item><title>Reproducing deadlocks involving only one table</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#9265026</link><pubDate>Fri, 02 Jan 2009 02:21:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9265026</guid><dc:creator>Alexander Kuznetsov</dc:creator><description>&lt;p&gt;Although the best known deadlock scenario involves two connections modifying two tables in different&lt;/p&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#9339840</link><pubDate>Mon, 19 Jan 2009 13:53:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9339840</guid><dc:creator>FrankG_sar</dc:creator><description>&lt;p&gt;Very interestings posts (the three ones).&lt;/p&gt;
&lt;p&gt;In my case I have deadlocks occuring during the syncrhonisation of pull subscribers of our merge replication (sql 2005).&lt;/p&gt;
&lt;p&gt;The trace is showing us system stored procedures of the merge replication involved in the deadlock. What are we supposed to do in that case ? To send these post to MS ? :-)&lt;/p&gt;
&lt;p&gt;Here is the trace. What would be the actions to do ?&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; deadlock-list&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp;deadlock victim=process928e38&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; process-list&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;process id=process928e38 taskpriority=5 logused=57720 waitresource=KEY: 7:72057595096006656 (de008218ea30) waittime=3343 ownerId=172382185 transactionname=user_transaction lasttranstarted=2009-01-14T15:47:16.470 XDES=0xdae3258 lockMode=U schedulerid=2 kpid=3184 status=suspended spid=166 sbid=0 ecid=0 priority=-5 transcount=2 lastbatchstarted=2009-01-14T15:47:16.410 lastbatchcompleted=2009-01-14T15:47:16.393 clientapp=900SE66\SQLPROD2008-saretec-PubSesame-901RA01\SQLEXPRESS-27 hostname=667 hostpid=5932 loginname=sa isolationlevel=read committed (2) xactid=172382185 currentdb=7 lockTimeout=4294967295 clientoption1=673384544 clientoption2=128024&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; executionStack&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;frame procname=mssqlsystemresource.sys.sp_MSmakegeneration line=489 stmtstart=44260 stmtend=44598 sqlhandle=0x0300ff7f587a2f069f52ee00bb9900000100000000000000&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; update dbo.MSmerge_genhistory with (rowlock)&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set genstatus = 1,&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; guidsrc = newid(),&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; coldate = getdate()&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where genstatus = 3 &amp;nbsp; &amp;nbsp; &lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inputbuf&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; Proc [Database Id = 32767 Object Id = 103774808] &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;process id=process929d38 taskpriority=0 logused=2668 waitresource=KEY: 7:72057595095810048 (c4026ce1c0d6) waittime=3390 ownerId=172382289 transactionname=UPDATE lasttranstarted=2009-01-14T15:47:16.487 XDES=0xb97ef40 lockMode=X schedulerid=2 kpid=2292 status=suspended spid=108 sbid=0 ecid=0 priority=0 transcount=2 lastbatchstarted=2009-01-14T15:47:16.487 lastbatchcompleted=2009-01-14T15:47:16.487 clientapp=.Net SqlClient Data Provider hostname=018PA01 hostpid=3420 loginname=sa isolationlevel=read committed (2) xactid=172382289 currentdb=7 lockTimeout=4294967295 clientoption1=673316896 clientoption2=128056&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; executionStack&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;frame procname=saretec.dbo.MSmerge_upd_1F5733FC149A4CBEA3E79A56B5BDD635 line=98 stmtstart=8862 stmtend=10288 sqlhandle=0x030007007da2e90011d07801719b00000000000000000000&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; update dbo.MSmerge_ctsv_1F5733FC149A4CBEA3E79A56B5BDD635 with (rowlock)&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set lineage = { fn UPDATELINEAGE(lineage, @replnick, @oldmaxversion+1) }, &lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; generation = @newgen, &lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; partchangegen = case when (@partchange = 1 or @joinchange = 1) then @newgen else partchangegen end, &lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; colv1 = { fn UPDATECOLVBM(colv1, @replnick, @bm, @missingbm, { fn GETMAXVERSION({ fn UPDATELINEAGE(lineage, @replnick, @oldmaxversion+1) }) }) } &amp;nbsp;&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FROM inserted as I JOIN dbo.MSmerge_ctsv_1F5733FC149A4CBEA3E79A56B5BDD635 as V with (rowlock)&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ON (I.rowguidcol=V.rowguid)&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; and V.tablenick = @tablenick&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; option (force order, loop join) &amp;nbsp; &amp;nbsp; &lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;frame procname=saretec.dbo.SES_MissionEtat_Maj line=17 stmtstart=814 stmtend=1114 sqlhandle=0x030007002574f346db9f7901719b00000100000000000000&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; UPDATE T_MISSION&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; 		SET INT_ETAT_PRIMAIRE = @INT_ETAT_PRIMAIRE,&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; 			SCD_ETATS_SECONDAIRES = @SCD_ETATS_SECONDAIRES&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; 		WHERE NUMIDT_MIS = @ID_MISSION &amp;nbsp; &amp;nbsp; &lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; inputbuf&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; Proc [Database Id = 7 Object Id = 1190360101] &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; resource-list&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;keylock hobtid=72057595095810048 dbid=7 objectname=saretec.dbo.MSmerge_contents indexname=nc2MSmerge_contents id=lock17ac4800 mode=S associatedObjectId=72057595095810048&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; owner-list&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;owner id=process928e38 mode=S&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; waiter-list&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;waiter id=process929d38 mode=X requestType=wait&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;keylock hobtid=72057595096006656 dbid=7 objectname=saretec.dbo.MSmerge_genhistory indexname=c1MSmerge_genhistory id=lock18ea6980 mode=X associatedObjectId=72057595096006656&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; owner-list&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;owner id=process929d38 mode=X&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; waiter-list&lt;/p&gt;
&lt;p&gt;2009-01-14 15:47:19.89 spid16s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;waiter id=process928e38 mode=U requestType=wait&lt;/p&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#9340417</link><pubDate>Mon, 19 Jan 2009 20:41:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9340417</guid><dc:creator>bartd</dc:creator><description>&lt;p&gt;FrankG, you may have meant it tongue-in-cheek :), but yes, I think your best bet may be to contact MS support for assistance with your deadlock involving MS repl-created tables. &amp;nbsp;The only option available to you without modifying system procs or system tables would be to force a different plan with a plan guide, and that approach to a solution may not &amp;quot;stick&amp;quot; across service packs or QFEs if the change updates the merge trigger or the MSMerge stored proc involved in the deadlock. &amp;nbsp;&lt;/p&gt;
</description></item><item><title>Reproducing one more intermittent deadlock on only one table</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#9511185</link><pubDate>Thu, 26 Mar 2009 19:00:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9511185</guid><dc:creator>Alexander Kuznetsov</dc:creator><description>&lt;p&gt;I have already described several deadlock scenarios that involve only one table in another post. This&lt;/p&gt;
</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#9573093</link><pubDate>Tue, 28 Apr 2009 09:39:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9573093</guid><dc:creator>Joon</dc:creator><description>&lt;p&gt;This is a really great article. &lt;/p&gt;
&lt;p&gt;I wish that I had access to something like this resource 5 years ago when I had to solve some spectacular deadlocking issues on a SQL Server 2000 app.&lt;/p&gt;
&lt;p&gt;I especially like the index tuning advisor hint - that is sooooo true. &lt;/p&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#9851310</link><pubDate>Tue, 28 Jul 2009 22:58:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9851310</guid><dc:creator>Rashmi</dc:creator><description>&lt;p&gt;Can 2 processes acquire rowlock on same row?&lt;/p&gt;
&lt;p&gt;I'm facing a deadlock where 2 processes have acquired row lock on same row and waiting for eachother. Here is the deadlock graph.&lt;/p&gt;
&lt;p&gt;2009-07-28 14:13:29.50 spid18s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ridlock fileid=1 pageid=10089 dbid=5 objectname=dcmdb.dcmdbuser.fs_payaccount id=lock1254ce80 mode=X associatedObjectId=72057595031977984&lt;/p&gt;
&lt;p&gt;2009-07-28 14:13:29.50 spid18s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; owner-list&lt;/p&gt;
&lt;p&gt;2009-07-28 14:13:29.50 spid18s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;owner id=process93af28 mode=X&lt;/p&gt;
&lt;p&gt;2009-07-28 14:13:29.50 spid18s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; waiter-list&lt;/p&gt;
&lt;p&gt;2009-07-28 14:13:29.50 spid18s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;waiter id=process93a988 mode=U requestType=wait&lt;/p&gt;
&lt;p&gt;2009-07-28 14:13:29.50 spid18s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ridlock fileid=1 pageid=10089 dbid=5 objectname=dcmdb.dcmdbuser.fs_payaccount id=lock1257ba00 mode=X associatedObjectId=72057595031977984&lt;/p&gt;
&lt;p&gt;2009-07-28 14:13:29.50 spid18s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; owner-list&lt;/p&gt;
&lt;p&gt;2009-07-28 14:13:29.50 spid18s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;owner id=process93a988 mode=X&lt;/p&gt;
&lt;p&gt;2009-07-28 14:13:29.50 spid18s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; waiter-list&lt;/p&gt;
&lt;p&gt;2009-07-28 14:13:29.50 spid18s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;waiter id=process93af28 mode=U requestType=wait&lt;/p&gt;
&lt;p&gt;As you can see above the associatedObjectId is same for both ridlocks.&lt;/p&gt;
&lt;p&gt;When can this happen? From the logic of my program 2 threads will never update the same row in fs_payaccount table.&lt;/p&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#9851360</link><pubDate>Tue, 28 Jul 2009 23:44:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9851360</guid><dc:creator>bartd</dc:creator><description>&lt;P&gt;Rashmi, &lt;/P&gt;
&lt;P&gt;"associatedObjectId" isn't a row identifier; it's the heap or B-tree identifier (HoBT ID -- see &lt;A href="http://msdn.microsoft.com/en-us/library/ms178104.aspx" target=_new rel=nofollow&gt;http://msdn.microsoft.com/en-us/library/ms178104.aspx&lt;/A&gt; for documentation of the 1211 output fields that aren't doc'ed in this post). &amp;nbsp;In other words, it just identifies the table or index. &amp;nbsp;You can look up the object name associated with a HoBT ID using "SELECT OBJECT_NAME(object_id) FROM sys.partitions WHERE hobt_id = xxx", but it would just tell you that the row lock is on table "dcmdb.dcmdbuser.fs_payaccount", which you can already tell from the rest of the 1211 output. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;In other words, there are two different rows (from the same table) involved in this deadlock.&amp;nbsp;&amp;nbsp;There's not enough information here to be sure, but my guess would be that one or both of the queries involved are scanning this table to locate the rows to update.&amp;nbsp; This would acquire Update locks on all rows.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description></item><item><title>re: Deadlock Troubleshooting, Part 1</title><link>http://blogs.msdn.com/bartd/archive/2006/09/09/Deadlock-Troubleshooting_2C00_-Part-1.aspx#9892579</link><pubDate>Tue, 08 Sep 2009 17:16:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9892579</guid><dc:creator>Cihat</dc:creator><description>&lt;p&gt;Thank you very much.Great article and it saved my day....&lt;/p&gt;</description></item></channel></rss>