Microsoft KB Archive/822853

= How To: Stop a Server-Side Trace in SQL Server 2000 =

Article ID: 822853

Article Last Modified on 5/16/2007

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition

-



SUMMARY
In Microsoft SQL Server 2000, you can trace SQL Server events by using a server-side trace that is performed by system stored procedures or by using a client-side trace that is performed by SQL Profiler. After you start a server-side trace, the trace continues to run and generates output until you stop the trace. This article describes how to stop a server-side trace.



MORE INFORMATION
To monitor the performance of an instance of SQL Server, you can trace the SQL Server event by using a server-side trace. To create the definition for the server-side trace, use the sp_trace_create system stored procedure. To start the trace, use the sp_trace_setstatus system stored procedure. To manually stop the server-side trace, you must locate the traceid trace event, stop the trace, and then delete the trace definition from the instance of SQL Server. To do so, follow these steps:  Start SQL Query Analyzer. Connect to the instance of SQL Server where the server-side trace is running.  Run the following Transact-SQL statement to retrieve the list of the running trace: SELECT * FROM ::fn_trace_getinfo(NULL)  Note the traceid of the server-side trace that you want to stop.  Run the following Transact-SQL statement to stop the server-side trace (where < > is the traceid that you noted in step 4): EXEC sp_trace_setstatus @traceid =, @status = 0   Run the following Transact-SQL statement to close the trace and to delete the trace information (where < > is the traceid that you noted in step 4): EXEC sp_trace_setstatus @traceid =, @status = 2 

<div class="references_section">