我正在查询 system_health 会话,并注意到并非所有事件都被返回。今天肯定很少有死锁,但这些不在输出中。
我遇到了这个连接文件,但从评论中这个问题已经在 SQL Server 2008 SP2 中得到解决。但我的版本是 SQL Server 2008 SP3 Standard。这里有更多细节。
那么这是一个错误还是我查询错误?
<RingBufferTarget truncated="1" eventsPerSec="31291" processingTime="209" totalEventsProcessed="6540" eventCount="1947" droppedCount="0" memoryUsed="4193813">
SELECT TOP 1 e.event.value('(@timestamp)[1]','datetime') AS MaxDate, GETDATE() Today
FROM
( SELECT ( SELECT
CONVERT(xml, target_data)
FROM sys.dm_xe_session_targets st
JOIN sys.dm_xe_sessions s ON
s.address = st.event_session_address
WHERE s.name = 'system_health'
AND st.target_name = 'ring_buffer'
)AS [x]
FOR XML PATH(''), TYPE
) AS the_xml(x)
CROSS APPLY x.nodes('x/RingBufferTarget/event') e (event)
ORDER BY MaxDate DESC
MaxDate Today
2013-01-09 20:05:31.853 2013-01-11 15:22:37.887