Saving Traces and Templates

Administering SQL Server

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:

  • Use a trace file or trace table to create a workload that is used as input for the Index Tuning Wizard.

  • Use a trace file to capture events and send the trace file to the support provider for analysis.

  • Use the query processing tools in SQL Server to access the data or to view the data in SQL Profiler. However, only members of the sysadmin fixed server role or the table creator can access the trace table directly.

    Important  Capturing trace data to a table is slower than capturing to a file. An alternative is to capture a trace to a file, open the trace file, and then save the trace as a trace table.

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