I'm trying to schedule a query to alert us when a deadlock occurs. My research has led me to extended events and the below query. I cant get the below to return any deadlock xml. i see the deadlocks in the log and sys health event file. Just not in the ring buffer. I recycled the sql logs. Would that have something to do with it? I have both 1204 and 1222 enabledSELECT xed.value('@timestamp', 'datetime') as Creation_Date, xed.query('.') AS Extend_EventFROM( SELECT CAST([target_data] AS XML) AS Target_Data FROM sys.dm_xe_session_targets AS xt INNER JOIN sys.dm_xe_sessions AS xs ON xs.address = xt.event_session_address WHERE xs.name = N'system_health' AND xt.target_name = N'ring_buffer') AS XML_DataCROSS APPLY Target_Data.nodes('RingBufferTarget/event[@name="xml_deadlock_report"]') AS XEventData(xed)ORDER BY Creation_Date DESC
↧