Skip to content

Instantly share code, notes, and snippets.

@alliwallibobali
Created October 1, 2021 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alliwallibobali/b37d5da45ceb75f59cd59dc8131f3e9f to your computer and use it in GitHub Desktop.
Save alliwallibobali/b37d5da45ceb75f59cd59dc8131f3e9f to your computer and use it in GitHub Desktop.
You can see which SQL Server Extended Event sessions are running using the following code
SELECT
[ses].[name] AS [Session Name],
CASE
WHEN [xs].[address] IS NOT NULL THEN 'Running'
ELSE 'Stopped'
END AS [State],
[xs].[create_time] AS [Start Time]
FROM sys.server_event_sessions AS [ses]
left outer JOIN sys.dm_xe_sessions AS [xs]
ON [ses].[name] = [xs].[name]
ORDER BY [State], [Start Time];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment