在2008之前我们分析死锁需要用profilertrace或者traceflag1222,1204.在2008中引入了一个新功能:ExtendedEvents(扩展事件),可以监控Deadlock事件,并且性能更好
SELECT xed.value('@timestamp', 'datetime') as Creation_Date, xed.query('.') AS Extend_Event FROM ( SELECT CAST([target_data] AS XML) AS Target_Data FROM sys.dm_xe_session_targetsAS xt INNERJOIN sys.dm_xe_sessions AS xs ONxs.address = xt.event_session_address WHERE xs.name = N'system_health' ANDxt.target_name =N'ring_buffer') AS XML_Data CROSS APPLY Target_Data.nodes('RingBufferTarget/event[@name="xml_deadlock_report"]') AS XEventData(xed) ORDER BY Creation_Date DESC
本文出自 “关注SQL Server技术” 博客,请务必保留此出处
,