Administering SQL Server

Saving Traces and Templates

Saving a trace involves saving the captured event data to a specified place. Saving a template involves saving the definition of the trace, such as specified data columns, events, and filters.

Saving Event Data

Save the captured event data to a file or a Microsoft® SQL Server™ table when you need to analyze or replay the captured data at a later time (for example, for trend forecasting or troubleshooting and debugging application problems). You can:

When using a trace file, SQL Profiler saves captured event data (not trace definitions) to a SQLProfiler (*.trc) file. The extension is added to the end of the file automatically when the trace file is saved, regardless of any other specified extension. For example, if you specify a trace file called Trace.dat, the file created is called Trace.dat.trc.

Note  If SQL Profiler is running on Microsoft Windows® 2000 or Microsoft Windows NT® 4.0, you cannot open trace or script files on a Windows 98 shared directory.

Saving Templates

The template definition of a trace includes the event classes, data columns, event criteria (filters), and all other properties (except the captured event data) used to create a trace. Templates created using SQL Profiler are saved in a file on the computer running SQL Profiler.

If you frequently monitor SQL Server, save templates in order to analyze performance. The templates capture the same event data each time and use the same trace definition to monitor the same events without having to define the event classes and data columns every time you create a trace. Additionally, a template can be given to another user to monitor specific SQL Server events. For example, a support provider can supply a customer with a template. The template is used by the customer to capture the required event data, which is then sent to the support provider for analysis.

To save a trace to a file

Profiler

Profiler

Transact-SQL

To save a trace to a table

Profiler

Profiler

Transact-SQL

To save a trace to the Windows NT application log

Transact-SQL

To forward event data to another server

Transact-SQL

To save a trace definition

Transact-SQL