SQL Server上的死锁跟踪

时间:2014-05-05 13:06:50

标签: sql sql-server sql-server-2008-r2 database-deadlocks

我正在研究死锁痕迹,但是我发现了没有受害进程的死锁,所以如果没有追踪受害进程或受害进程的inputbuf为空,死锁意味着什么?

请在下面找到死锁的XML图表,没有为受害过程定义输入。

<event name="xml_deadlock_report" package="sqlserver" id="123" version="1" timestamp="2014-05-04T12:44:37.917Z">
  <data name="xml_report">
    <type name="unicode_string" package="package0" />
    <value><deadlock>
 <victim-list>
  <victimProcess id="process1369fdc8"/>
 </victim-list>
 <process-list>
  <process id="process1369fdc8" taskpriority="0" logused="0" waitresource="PAGE: 7:1:1859678" waittime="39886" ownerId="26953881" transactionname="UPDATE" lasttranstarted="2014-05-04T15:44:01.870" XDES="0x7b2bca2f0" lockMode="U" schedulerid="79" kpid="9072" status="suspended" spid="94" sbid="0" ecid="15" priority="0" trancount="0" lastbatchstarted="2014-05-04T15:44:01.540" lastbatchcompleted="2014-05-04T15:44:01.540" clientapp=".Net SqlClient Data Provider" hostname="E-DHQ-UMRSDB" hostpid="21448" isolationlevel="read committed (2)" xactid="26953881" currentdb="7" lockTimeout="4294967295" clientoption1="673185824" clientoption2="128056">
   <executionStack>
    <frame procname="" line="17" stmtstart="1166" stmtend="1840" sqlhandle="0x03000700cc7bde09501015010da300000100000000000000">
    </frame>
    <frame procname="" line="1" stmtstart="68" sqlhandle="0x01000700cb9c391ff09dd28a0a0000000000000000000000">
    </frame>
    <frame procname="" line="1" sqlhandle="0x000000000000000000000000000000000000000000000000">
    </frame>
   </executionStack>
   <inputbuf>
   </inputbuf>
  </process>
  <process id="process12d76bc8" taskpriority="0" logused="473152" waitresource="PAGE: 7:1:1859677" waittime="1787" ownerId="26919083" transactionname="user_transaction" lasttranstarted="2014-05-04T15:42:05.963" XDES="0xadb2a63b0" lockMode="IX" schedulerid="55" kpid="23948" status="suspended" spid="72" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2014-05-04T15:44:40" lastbatchcompleted="2014-05-04T15:44:39.950" lastattention="2014-05-04T15:31:58.570" clientapp=".Net SqlClient Data Provider" hostname="E-DHQ-UMRSAPPN2" hostpid="21300" loginname="SEC\S-ISD-UMRS" isolationlevel="read committed (2)" xactid="26919083" currentdb="7" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056">
   <executionStack>
    <frame procname="" line="1" stmtstart="1270" sqlhandle="0x02000000e5c9362166f41bf7f95f3653aba53c8419996b90">
    </frame>
    <frame procname="" line="1" sqlhandle="0x000000000000000000000000000000000000000000000000">
    </frame>
   </executionStack>
   <inputbuf>
(@p0 int,@p1 varchar(8000),@p2 varchar(8000),@p3 int,@p4 varchar(8000),@p5 int,@p6 int,@p7 int,@p8 float,@p9 varchar(8000),@p10 tinyint,@p11 int,@p12 int,@p13 varchar(8000),@p14 int,@p15 varchar(8000),@p16 varchar(8000),@p17 varchar(8000),@p18 varchar(8000),@p19 varchar(8000),@p20 int,@p21 int,@p22 int,@p23 int,@p24 datetime,@p25 datetime,@p26 int,@p27 varchar(8000),@p28 int,@p29 int,@p30 int,@p31 datetime,@p32 int,@p33 float,@p34 int,@p35 int,@p36 int,@p37 int,@p38 int,@p39 int,@p40 varchar(8000),@p41 int,@p42 varchar(8000),@p43 decimal(18,8),@p44 smalldatetime,@p45 smalldatetime,@p46 varchar(8000),@p47 int,@p48 smalldatetime)UPDATE [dbo].[Meter]
SET [ReadingStatusID] = @p47, [LastEditDate] = @p48
WHERE ([ID] = @p0) AND ([SerialNumber] = @p1) AND ([SubscribtionNumber] = @p2) AND ([SubscriberID] = @p3) AND ([SubscriberNumber] = @p4) AND ([NumberOfDigits] IS NULL) AND ([BreakerCapacity] = @p5) AND ([TariffTypeID] = @p6) AND ([BusinessUnitID] = @p7) AND ([MultiplicationFactor] = @p8) AND ([AccumulationNumber   </inputbuf>
  </process>
 </process-list>
 <resource-list>
  <pagelock fileid="1" pageid="1859678" dbid="7" objectname="" id="lockb618fbd00" mode="IX" associatedObjectId="72057594953859072">
   <owner-list>
    <owner id="process12d76bc8" mode="IX"/>
   </owner-list>
   <waiter-list>
    <waiter id="process1369fdc8" mode="U" requestType="wait"/>
   </waiter-list>
  </pagelock>
  <pagelock fileid="1" pageid="1859677" dbid="7" objectname="" id="lock1e573c580" mode="U" associatedObjectId="72057594953859072">
   <owner-list>
    <owner id="process1369fdc8" mode="U"/>
   </owner-list>
   <waiter-list>
    <waiter id="process12d76bc8" mode="IX" requestType="wait"/>
   </waiter-list>
  </pagelock>
 </resource-list>
</deadlock>
</value>
    <text />
  </data>
</event>

1 个答案:

答案 0 :(得分:0)

尝试启用这些SQL服务器标志。我发现这些标志对于找到有问题的SQL非常有用,并且还为您提供了额外的信息。

dbcc tracestatus(-1)
DBCC Traceon (1204, 1222, -1)
dbcc tracestatus(-1)

-- 1204 Deadlock resources and type of locks participating in a deadlock
-- 1222 Deadlock resources and also current command affected.

/*
dbcc traceoff (1204 ,-1)
dbcc traceoff (1222 ,-1)
*/

RosSQL.blogspot.com