Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

This tutorial will help you learning SQL Server Profiler

Authors

Getting Started with SQL Server Profiler

Getting Started with SQL Server Profiler - Part 2: Profiler Templates, Template Types and Creating Customized Templates

Jul 3 2012 12:00AM by Nakul Vachhrajani   

Today, we will attempt to answer the following questions:

  1. What is a Profiler Template?
  2. What are the various types of Templates available within the SQL Server profiler?
  3. How to create customized templates?

Profiler Templates

We talked yesterday about SQL Traces and it’s components. SQL Server Profiler ships with templates that define the event classes and data columns to include in traces. It is important to understand that when we execute the SQL Server Profiler, we are capturing a SQL Trace and the template gives body to the trace, i.e. the template is used to represent the events and data columns captured in the trace, but the template is itself never “executed”.

Template Types

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. To view the list of available templates, click on the “New Trace” button on the toolbar, and then expand the “Use the template” drop-down.

“Use the template” drop-down

NOTE: If you are using a version of the SQL Server Profiler that’s different than the SQL Server instance, then the template drop-down may be blank, and you may be required to use a customized template.

Below is a brief description of the various template types available in the SQL Server Profiler. To know more about the various Event Classes associated to each, please refer the Books On Line documentation referenced in the “References” section of this post. The ones I have used most in my career till date are: TSQLDuration, TSQLLocks and TSQL_SPs.

template types

Customizing a Profiler trace

To have a best of all worlds, one might want to create a custom Profiler template. To create a custom template, one can follow the following steps:

Go to File >> Templates >> New Template

template

Select “Server Type”

server type

Supply a name for the template, and also choose whether the template should be based on an existing template or not

template name

Go to “Events” tab and add/remove events captured using the “Show All Events” check box.

NOTE that I have removed a few default events and have added 2 new ones

event selection

Using the “Show All Columns”, I added one additional data column capture

data column capture

Go to “Column Filters” to apply filters on the data columns

NOTE: If multiple criteria are defined, the “AND” operator is used

edit filters

Go to “Organize columns” to define the sequence in which columns should appear and also to group by any particular column

organizing columns

Once all adjustments are done, click on “Save” to save the template

saving the template

The trace will then appear in the “Use the template” drop-down when starting a new trace for the given server type

use the template

Setting the Default Trace

Let’s assume that we need to set the trace we just created as the default trace. Here are the very simple sequence of steps to follow:

Navigate to File >> Templates >> Edit Template

edit template

Select the Server Type and Template Name to edit

server type and template type

Check the “Use as a default template for selected server type”.

NOTE: You can also use this interface to delete a trace template.

default template option

Storage & Exporting/Importing templates

Customization of templates is machine and user specific. That means that the template must be stored on the disk as a physical file. A simple file-system search reveals the location of the template file:

For SQL 2012 (code named: “Denali”), the template is available at: C:\Users\<<<user name>>>\AppData\Roaming\Microsoft\SQL Profiler\11.0\Templates\Microsoft SQL Server\110

So, here’s a tip – the next time you backup your system, also backup your templates so that you don’t have to set them up again! You can Export or Import your existing templates by going to File->Templates->Export Template/Import Template:

import template

In my next post…

In the next post, I will be writing about the various options available to execute the trace. Finally, towards the end of the week we would look at other uses of Profiler (specifically, trace replay). References

Please find below some of the reference Books On Line documentation that I found when researching for this post:

  1. SQL Server Profiler Templates
  2. Creating a trace
  3. Set Trace Definition Defaults

Nakul Vachhrajani
4 · 33% · 10680
6 Readers Liked this
Neha Mewara Liked this on 7/3/2012 1:32:00 AM
Profile
Nakul Vachhrajani Liked this on 7/3/2012 4:27:00 AM
Profile · Blog · Facebook · Twitter
Jacob Sebastian Liked this on 7/3/2012 7:18:00 AM
Profile · Blog · Facebook · Twitter
Khyati Patel Liked this on 7/3/2012 7:24:00 AM
Profile · Facebook · Twitter
Olga Medvedeva Liked this on 7/4/2012 4:38:00 AM
Profile · Blog · Twitter
Guru Samy Liked this on 7/6/2012 4:05:00 AM
Profile · Blog
6
Liked



Submit

Your Comment


Sign Up or Login to post a comment.

"Getting Started with SQL Server Profiler - Part 2: Profiler Templates, Template Types and Creating Customized Templates" rated 5 out of 5 by 6 readers
Getting Started with SQL Server Profiler - Part 2: Profiler Templates, Template Types and Creating Customized Templates , 5.0 out of 5 based on 6 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]