Muokkaa

Jaa


SQL Server Profiler Templates

Applies to: SQL Server Azure SQL Managed Instance

You can use SQL Server Profiler to create templates that define the event classes and data columns to include in traces. After you define and save the template, you can run a trace that records the data for each event class you selected. You can use a template on many traces; the template is not itself executed.

SQL Server Profiler offers predefined trace templates that allow you to easily configure the event classes that you will most likely need for specific traces. The Standard template, for example, helps you to create a generic trace for recording logins, logouts, batches completed, and connection information. You can use this template to run traces without modification or as a starting point for additional templates with different event configurations.

Note

In addition to traces from predefined templates, SQL Server Profiler also allows you to create them from a blank template, containing no event classes by default. Using the blank trace template can be useful when a planned trace does not resemble the configurations of any of the predefined templates.

SQL Server Profiler can trace a variety of server types. For example you can trace Analysis Services and SQL Server. However, the event classes that can be included are not the same for each type of server. Therefore, SQL Server Profiler maintains different templates for different servers, and makes available the specific template that matches the selected server type.

Predefined Templates

In addition to the Standard (default) template, SQL Server Profiler includes several predefined templates for monitoring certain types of events. The following table lists the predefined templates, their purpose, and the event classes for which they capture information.

Template name Template purpose Event classes
SP_Counts Captures stored procedure execution behavior over time. SP:Starting
Standard Generic starting point for creating a trace. Captures all stored procedures and Transact-SQL batches that are run. Use to monitor general database server activity. Audit Login

Audit Logout

ExistingConnection

RPC:Completed

SQL:BatchCompleted

SQL:BatchStarting
TSQL Captures all Transact-SQL statements that are submitted to SQL Server by clients and the time issued. Use to debug client applications. Audit Login

Audit Logout

ExistingConnection

RPC:Starting

SQL:BatchStarting
TSQL_Duration Captures all Transact-SQL statements submitted to SQL Server by clients, their execution time (in milliseconds), and groups them by duration. Use to identify slow queries. RPC:Completed

SQL:BatchCompleted
TSQL_Grouped Captures all Transact-SQL statements submitted to SQL Server and the time they were issued. Groups information by user or client that submitted the statement. Use to investigate queries from a particular client or user. Audit Login

Audit Logout

ExistingConnection

RPC:Starting

SQL:BatchStarting
TSQL_Locks Captures all of the Transact-SQL statements that are submitted to SQL Server by clients along with exceptional lock events. Use to troubleshoot deadlocks, lock time-out, and lock escalation events. Blocked Process Report

SP:StmtCompleted

SP:StmtStarting

SQL:StmtCompleted

SQL:StmtStarting

Deadlock Graph

Lock:Cancel

Lock:Deadlock

Lock:Deadlock Chain

Lock:Escalation

Lock:Timeout (timeout>0)
TSQL_Replay Captures detailed information about Transact-SQL statements that is required if the trace will be replayed. Use to perform iterative tuning, such as benchmark testing. CursorClose

CursorExecute

CursorOpen

CursorPrepare

CursorUnprepare

Audit Login

Audit Logout

Existing Connection

RPC Output Parameter

RPC:Completed

RPC:Starting

Exec Prepared SQL

Prepare SQL

SQL:BatchCompleted

SQL:BatchStarting
TSQL_SPs Captures detailed information about all executing stored procedures. Use to analyze the component steps of stored procedures. Add the SP:Recompile event if you suspect that procedures are being recompiled. Audit Login

Audit Logout

ExistingConnection

RPC:Starting

SP:Completed

SP:Starting

SP:StmtStarting

SQL:BatchStarting
Tuning Captures information about stored procedures and Transact-SQL batch execution. Use to produce trace output that Database Engine Tuning Advisor can use as a workload to tune databases. RPC:Completed

SP:StmtCompleted

SQL:BatchCompleted

For information about the event classes, see SQL Server Event Class Reference.

Default Template

SQL Server Profiler automatically designates the Standard template as the default template applied to any new trace. However you can change the default template to any other predefined or user-defined template. To change the default template, select the Use as a default template for selected server type check box when you create or edit a template by using the General tab of the Trace Template Properties dialog box.

To navigate to the Trace Template Properties dialog box, on the SQL Server Profiler File menu, choose Templates, and then click New Template or Edit Template.

Note

The default template is specific for a given server type. Changing the default for one server type does not affect the default template for any other server type. For more information about setting a default template for a specific server, see Set Trace Definition Defaults (SQL Server Profiler).

See Also

Create a Trace Template (SQL Server Profiler)
Modify a Trace Template (SQL Server Profiler)
Export a Trace Template (SQL Server Profiler)
Import a Trace Template (SQL Server Profiler)