sys.traces (Transact-SQL)


THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)noAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

The sys.traces catalog view contains the current running traces on the system. This view is intended as a replacement for the fn_trace_getinfo function.

For a complete list of supported trace events, see SQL Server Event Class Reference.

System_CAPS_ICON_important.jpg Important

This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use Extended Event catalog views instead.

Applies to: SQL Server (SQL Server 2008 through current version).
Column nameData typeDescription
idintTrace ID.
statusintTrace status:

0 = stopped

1 = running
pathnvarchar(260)Path of the trace file. This value is null when the trace is a rowset trace.
max_sizebigintMaximum trace file size limit in megabytes (MB). This value is null when the trace is a rowset trace.
stop_timedatetimeTime to stop the running trace.
max_filesintMaximum number of rollover files. This value is null if the Max number is not set.
is_rowsetbit1 = rowset trace.
is_rolloverbit1 = rollover option is enabled.
is_shutdownbit1 = shutdown option is enabled.
is_defaultbit1 = default trace.
buffer_countintNumber of in-memory buffers used by the trace.
buffer_sizeintSize of each buffer (KB).
file_positionbigintLast trace file position. This value is null when the trace is a rowset trace.
reader_spidintRowset trace reader session ID. This value is null when the trace is a file trace.
start_timedatetimeTrace start time.
last_event_timedatetimeTime the last event fired.
event_countbigintTotal number of events that occurred.
dropped_event_countintTotal number of events dropped.

The visibility of the metadata in catalog views is limited to securables that a user either owns or on which the user has been granted some permission. For more information, see Metadata Visibility Configuration.

Object Catalog Views (Transact-SQL)
sys.trace_categories (Transact-SQL)
sys.trace_columns (Transact-SQL)
sys.trace_events (Transact-SQL)
sys.trace_event_bindings (Transact-SQL)
sys.trace_subclass_values (Transact-SQL)

Community Additions