我正在尝试学习如何分析SQL Server 2008的死锁图,并且发现了大量带有空<victim-list>
节点的条目。我不明白这些条目代表什么:如果没有受害者,我如何确定导致死锁的waitresource?这些条目是什么意思?
这是我看到的条目的快速示例:
<deadlock-list>
<deadlock>
<victim-list />
<process-list>
<process id="processd2b6508" taskpriority="0" logused="10000" waittime="31" schedulerid="63" kpid="9104" status="suspended" spid="69" sbid="0" ecid="184" priority="0" trancount="0" lastbatchstarted="2012-07-30T01:10:45.550" lastbatchcompleted="2012-07-30T01:10:45.550" clientapp=".Net SqlClient Data Provider" hostname="XXXXXXX" hostpid="3648" isolationlevel="read committed (2)" xactid="30461033" currentdb="5" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056">
<executionStack>
<frame procname="" line="1" sqlhandle="0x020000002340c50225c17d0eec9bf7c51129348edffd1c70" />
<!--About 2 more frame tags... -->
</executionStack>
<inputbuf />
</process>
<!-- 3 or so more process tags... -->
</process-list>
<resource-list>
<exchangeEvent id="Pipeb005eeba0" WaitType="e_waitPipeNewRow" nodeId="7">
<owner-list>
<owner id="processd23fdc8" />
</owner-list>
<waiter-list>
<waiter id="processd2b6508" />
</waiter-list>
</exchangeEvent>
<!-- 2 more exchangeEvents -->
</resource-list>
</deadlock>
</deadlock-list>
**编辑**根据要求,以下是用于通过sqlhandle标识查询的查询:
select sql_handle as Handle,
SUBSTRING(st.text, (qs.statement_start_offset/2)+1,
((CASE qs.statement_end_offset
WHEN -1 THEN DATALENGTH(st.text)
ELSE qs.statement_end_offset
END - qs.statement_start_offset)/2) + 1) AS Text
from sys.dm_exec_query_stats as qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS st
where sql_handle = --0x04000D00E3572A56542E4601CE9E00010100001000000000
我的SQL Server版本是10.50.1617.0
—
Slider345