This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing a SQL DBA Script for getting the definition of default trace of SQL Server.
Why is this important?
When you are running multiple traces on your SQL Server while troubleshooting particular event, you should know the definition of the particular trace which helps you in the better investigation.
Using fn_trace_geteventinfo, you can get the trace definition.
Get the default trace_id of instance:
1 2 3 4 5 6 7 |
SELECT distinct traceid FROM ::fn_trace_getinfo(default) GO traceid ----------- 1 |
Pass trace_id in fn_trace_geteventinfo() and get the definition of Trace:
1 2 3 4 5 6 7 8 9 10 |
select tg.eventid as EventID ,te.Name as EventName ,tg.columnid as ColumnID ,cols. name as ColumnName from :: fn_trace_geteventinfo (1) as tg INNER JOIN sys.trace_events as te ON tg.eventid = te.trace_event_id INNER JOIN sys.trace_columns cols ON tg.columnid = cols.trace_column_id |
Leave a Reply