In this post, I am sharing one TSQL script to find the status of SQL Server Trace.
The SQL Server Trace is very important to trace different SQL Server event for errors finding, object changes information and others.
Using this script you can find different information of the Trace like: Trace is running or not, Type of the trace, File path of the trace.
I am fetching require trace column using a sys.traces.
Below is a script:
WHEN 1 THEN 'Default/System Trace'
WHEN 0 THEN 'User Defined Trace'
END AS TraceType
WHEN 1 THEN 'Running'
WHEN 0 THEN 'Stopped'
END AS TraceStrace
,ES.session_id AS SessionID
,ES.login_name AS LoginName
,T.Path AS TraceFilePath
FROM sys.traces AS T
LEFT JOIN sys.dm_exec_sessions AS ES
ON T.reader_spid = ES.session_id
Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.
If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.
I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.