Default Trace reader is available since the version 1.4.5
Did you know that a trace is actually running on your SQL Server ? Except if you disabled it, the default trace should run on your server. You don’t trust me ? Execute this query :
SELECT * FROM sys.traces WHERE id = 1
Ok, now I convinced you, no ? 🙂
If the default trace is disabled, you can enable it with this code
sp_configure 'show advanced options', 1; GO RECONFIGURE; GO sp_configure 'default trace enabled', 1; GO RECONFIGURE; GO
What’s this trace ?
This is a simple lightweight trace that is collecting lot of useful information. For example, if someone create an object, add permission, start an audit, execute a query with missing statistics, you’ll have a row in this trace
Default Trace reader
This tool uses 4 queries in KMO to get data :
GetTraceCategories : return the list of all categories (to fill the combobox)
ReadDefaultTrace : this method returns the rows from the default trace using sys.fn_trace_gettable. Data are filtered by date and may be aslo filtered by category. By default, the row count is limited to 1000 for performance matters.
DefaultTraceCountByCategory : return the row count group by category. List of categories is available in sys.trace_categories.
DefaultTraceCountByEvent : return the row count group by event. List of events is available in sys.trace_events.