Partilhar via


Starting, Pausing, and Stopping Traces

After you have defined a new trace or created a template by using SQL Server Profiler, you can start, pause, or stop capturing data by using the new trace definition or template.

Starting a Trace

When you start a trace and the defined source is an instance of the SQL Server Database Engine or Analysis Services, SQL Server creates a queue that provides a temporary holding place for captured server events.

When you use SQL Server Profiler to access SQL Trace, a new trace window opens (if one is not already open) when a trace is started, and data is immediately captured.

When you use Transact-SQL system stored procedures to access SQL Trace, you must start a trace every time an instance of SQL Server starts for data to be captured. When a trace has been started, you can modify only the name of the trace.

Note

When working with existing traces, you can view the properties, but you cannot modify the properties. To modify the properties, stop or pause the trace.

Pausing a Trace

When you pause a trace, you prevent event data from being captured until the trace is restarted. Restarting a trace lets trace operations resume. No previously captured data is lost after a restart. When the trace is restarted, data capturing resumes from that point onward. While a trace is paused, you can change the name, events, columns, and filters. However, you cannot change the destinations to which you are sending the trace data, nor change the server connection.

Stopping a Trace

Stopping a trace stops data from being captured. After a trace is stopped, it cannot be restarted without losing previously captured data, unless the data has been captured to a trace file or trace table. You can also save the collected data to a table or file after stopping a trace. All trace properties that were previously selected are preserved when a trace is stopped. When a trace is stopped, you can change the name, events, columns, and filters.

See Also

Tasks

How to: Run a Trace After It Has Been Paused or Stopped (SQL Server Profiler)
How to: Pause a Trace (SQL Server Profiler)
How to: Stop a Trace (SQL Server Profiler)
How to: Clear a Trace Window (SQL Server Profiler)
How to: Close a Trace Window (SQL Server Profiler)

Help and Information

Getting SQL Server 2005 Assistance