Call now: (800) 766-1884  


 SQL Server Tips
 SQL Server Training

 SQL Server Consulting
 SQL Server Support
 SQL Server Remote DBA

 SQL Server Scripts
 Scripts Menu




  SQL Server Tips by Robin Schumacher

Creating Traces

Every DBA is going to have their own preferences as to what events they want to trace, as well as what columns they want to see in terms of statistical metrics. That said, the up_wl_trace_sql procedure below allows the DBA to capture the SQL executions likely needed (individual SQL executions, procedure runs, plus SQL calls from each procedure run) to obtain the majority of statistics desired; excluding Microsoft system operations (SQL Agent, etc.) and allowing filters to be set on CPU, Reads, and Duration.

* up_wl_trace_sql

-- Script is available in the Online Code Depot

The procedure’s one required input is a trace file name written to the server. The trace will have to be manually stopped with a couple of commands that require the trace number. This trace number is outputted when the above procedure is run. If, for example, the trace number was one, the following commands would need to be issued for the file to be closed and available for analysis:

exec sp_trace_setstatus 1,0
exec sp_trace_setstatus 1,2

The above book excerpt is from:

High-Performance SQL Server DBA
Tuning & Optimization Secrets

ISBN: 0-9761573-6-5
Robin Schumacher  


Burleson Consulting Remote DB Administration







Burleson is the America's Team

Note: The pages on this site were created as a support and training reference for use by our staff of DBA consultants.  If you find it confusing, please exit this page.

Errata?  SQL Server technology is changing and we strive to update our SQL Server support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:and include the URL for the page.

Burleson Consulting
SQL Server database support


Copyright © 1996 -  2013 by Vaaltech Web Services. All rights reserved.

Hit Counter