Using SQL Trace
The process of tracing with SQL Trace varies depending on whether you create and run your trace by using Microsoft SQL Server Profiler or by using system stored procedures.
As an alternative to SQL Server Profiler, you can use Transact-SQL system stored procedures to create and run traces. The process of tracing by using system stored procedures is as follows:
Create a trace by using sp_trace_create.
Add events with sp_trace_setevent.
(Optional) Set a filter with sp_trace_setfilter.
Start the trace with sp_trace_setstatus.
Stop the trace with sp_trace_setstatus.
Close the trace with sp_trace_setstatus.
Using Transact-SQL system stored procedures creates a server-side trace, which guarantees that no events will be lost as long as there is space on the disk and no write errors occur. If the disk becomes full or the disk fails, the SQL Server instance continues to run, but tracing stops. If the c2 audit mode is set, and there is a write failure, tracing stops and the SQL Server instance shuts down. For more information about the c2 audit mode setting, see c2 audit mode Option.
Contains information about the data columns that are used to describe attributes of events.
Contains information about saving trace results to a file or to a table.
Contains information about ways you can reduce the effects of tracing on system performance.
Contains information about using filters for tracing.
Contains information about how to limit the size of files and tables where trace data is written. Note that only SQL Server Profiler can write trace information to tables.
Contains information about how to set the start time and the end time for tracing.