For old-school traces, I can look in sys.traces or the SQL Server log to find when a trace was started. Is there something similar for Extended Events? I came across this blog entry about using a DDL trigger but I'm wondering if there is something better.

SQL Server 2012-2014

2 Answers 2


There is but it does not necessarily provide a "status" itself. If you look at the definition of sys.dm_xe_sessions in Books Online here:

Returns information about an active extended events session. This session is a collection of events, actions, and targets.

The key is active extended events sessions, this DMV is only going to return those XE sessions that are running. So you basically just look at the create_time and that is when the session was started. You can verify this by looking at the system_health session as the time returned should match up to when the instance was last started.

An example is my SQL Server 2012 instance on my local machine is kept stopped most of the time until I need it. I just started it so you can see the times are pretty close: enter image description here

  • Things to consider for the above are that those events that end in $A are SQL Audits and that I have found the the create_time to not be reliable. I am looking at several create times right this moment where the extended event is indeed running but starts "19 days from now".
    – PseudoToad
    Sep 5, 2017 at 21:10
  • I've learned that SMO can you show both active and inactive sessions. It got added as a command in the dbatools module.
    – user507
    Sep 5, 2017 at 21:13
  • Have you since found a way to find non active sessions without SMO? Oct 23, 2020 at 10:06

Here is a quick code to check if specified Extended Event Session exists and if it is enabled or disabled:

DECLARE @xe AS VARCHAR(99) = 'AlwaysOn_health'
IF EXISTS (SELECT 1 FROM sys.server_event_sessions WHERE name = @xe)
        IF EXISTS (SELECT 1 FROM sys.dm_xe_sessions WHERE name = @xe)
            PRINT 'XE "' + @xe + '" exists and it is currently enabled.'
            PRINT 'XE "' + @xe + '" exists but it is currently diabled.'
        PRINT 'XE "' + @xe + '" doesn''t exist. (check name)'


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.