我正在尝试学习如何分析SQL Server 2008 的死锁图,并且我发现了很多带有空<victim-list>
节点的条目。我不明白这些条目代表什么:如果没有受害者,我如何识别导致死锁的等待资源?这些条目是什么意思?
这是我看到的条目的一个快速示例:
<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 …
Run Code Online (Sandbox Code Playgroud) 在 SQL Server 2008 R2 中,我收到了几个死锁报告,输入缓冲区中有“*password------------”。看起来像是攻击,但在那种情况下,我不知道攻击的原因或类型。
(日志是由一位经验丰富的 DBA 专家生成的,并告诉我,不是我)
有谁知道它是什么?谢谢!
例子:
<?xml version="1.0"?>
<blocked-process>
<process id="process879948" taskpriority="0" logused="0" waitresource="KEY: 5:72057602473263104 (1d69201d0ba6)" waittime="5185" ownerId="88389135" transactionname="SELECT" lasttranstarted="2012-09-25T18:11:02.507" XDES="0x1f7d2a590" lockMode="S" schedulerid="2" kpid="4552" status="suspended" spid="86" sbid="2" ecid="0" priority="0" trancount="0" lastbatchstarted="2012-09-25T18:11:02.507" lastbatchcompleted="2012-09-25T18:11:02.507" lastattention="2012-09-25T18:07:35.740" clientapp=".Net SqlClient Data Provider" hostname="IP-xxxxxxxx" hostpid="4868" loginname="sa" isolationlevel="read committed (2)" xactid="88389135" currentdb="1" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056">
<executionStack>
<frame line="14" stmtstart="374" stmtend="764" sqlhandle="0x03000500dac2967f208e4000a19d00000000000000000000"/>
<frame line="1" stmtstart="44" sqlhandle="0x02000000632f7e131f79ec7312284505961e537a61b81be7"/>
<frame line="1" sqlhandle="0x000000000000000000000000000000000000000000000000"/>
</executionStack>
<inputbuf>
*password--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- </inputbuf>
</process>
</blocked-process>
Run Code Online (Sandbox Code Playgroud) 我一直在处理死锁,特别是获取他们的信息,正如你在这篇文章中看到的。
在同一篇文章中,Shanky推荐了“您现在必须依靠扩展事件跟踪来捕获死锁信息”
我的问题是:
1) 使用扩展事件是否会增加 CPU?
2) 它使用了多少内存、磁盘空间和 I/O?
任何相关文档的链接都将是奖励。
我目前正在使用此灾难通过读取system_health
扩展事件环形缓冲区来定位最近的死锁。
select top 2000000000
XEvent.value('@timestamp', 'datetime2(3)') as CreationDateUtc,
--
-- Extract the <deadlock>...</deadlock> tag from within the event
-- Todo: Surely there is a better (xml) way to do this.
--
substring(convert(varchar(max), XEvent.query('.')),
-- start
patindex('%<deadlock%', convert(varchar(max), XEvent.query('.'))),
-- end
patindex('%</deadlock%', convert(varchar(max), XEvent.query('.'))) -
patindex('%<deadlock%', convert(varchar(max), XEvent.query('.'))) + 11 -- 11 to include for '</deadlock>'
) AS XdlFile
from
(
select cast (target_data as xml) as TargetData
from sys.dm_xe_session_targets st with (nolock)
join sys.dm_xe_sessions s with (nolock)
on …
Run Code Online (Sandbox Code Playgroud)