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


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 '17 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 '17 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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