forked from MasayukiOzawa/SQLServer-Util
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cbf5daf
commit feb8ba6
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
SELECT | ||
[type] | ||
FROM | ||
( | ||
SELECT | ||
record.value('(/Record/@type)[1]', 'varchar(500)') AS [type] | ||
FROM | ||
( | ||
SELECT | ||
timestamp, | ||
CAST(record AS xml) AS record | ||
FROM | ||
sys.dm_os_ring_buffers | ||
) AS T | ||
) AS T2 | ||
GROUP BY type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
SELECT | ||
DATEADD (ms, -1 * (si.ms_ticks - [timestamp]), GETDATE()) AS utc_time, | ||
T.* | ||
FROM | ||
( | ||
SELECT | ||
timestamp, | ||
CAST(record AS xml) AS record | ||
FROM | ||
sys.dm_os_ring_buffers | ||
) AS T | ||
CROSS JOIN | ||
sys.dm_os_sys_info si | ||
WHERE | ||
record.exist('/Record[@type="RING_BUFFER_MEMORY_BROKER"]') > 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
DROP TABLE IF EXISTS #system_health | ||
CREATE TABLE #system_health (c1 int primary key, target_data xml) | ||
CREATE PRIMARY XML INDEX system_health_xml_index ON #system_health (target_data) | ||
|
||
INSERT INTO #system_health | ||
SELECT | ||
1, | ||
CAST(target_data AS xml) AS target_data | ||
FROM | ||
sys.dm_xe_session_targets | ||
WHERE | ||
event_session_address = | ||
(SELECT address FROM sys.dm_xe_sessions WHERE name = 'system_health') | ||
AND | ||
target_name = 'ring_buffer' | ||
GO | ||
|
||
SELECT target_event | ||
FROM ( | ||
SELECT | ||
CAST(event.query('data(./@name)') AS varchar(100)) AS target_event | ||
FROM | ||
( | ||
SELECT * FROM #system_health | ||
) AS T | ||
OUTER APPLY target_data.nodes('//event') AS T2(event) | ||
) AS T2 | ||
GROUP BY target_event |