Home > How to use SQL Trace definition
Step-by-Step Guide:
EMAIL THIS LICENSING & REPRINTS

How to use SQL Trace definition

19 Mar 2007 | By Michelle Gutzait

Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   

How to use the trace definition:
Now that you have the trace definition on hand, you can run a job that creates a trace and saves the results to a table every X minutes.
Here are the steps to accomplish that:
  1. Create a table that holds your trace number.
  2. Create a table that will hold the trace results.
  3. Create a job that runs every X minutes (e.g., 10 minutes). The job will do the following:

  4. a. Check if there is a trace running (querying the table that holds the trace number)
    b. If a trace is running:
    → Stop the trace.
    → Insert the results from the file into the table holding the trace results.
    → Start the trace.

    Else (the trace is not running):
    → Create and start the trace.
    → Keep the trace number in the table.

You probably want to trace the production environment, but remember to keep the trace results in a separate environment (let's call it "Monitor" environment). This way production performance is not affected.
In this case, you would need to use a DTS/SSIS package that does the following:

  1. In production -- Create a table that holds your trace number.
  2. In "Monitor" environment -- Create a table that will hold the trace results.
  3. Create a job that runs every X minutes (e.g., 10 minutes). The job will run a DTS/SSIS package that does the following:

  4. c. In production --
    i. Checks if there is a trace running (querying the table that holds the trace number)
    ii. If a trace is running:
    → Stops the trace.
    → In "Monitor" environment -- inserts the results from the file into the table holding the trace results. Makes sure the directory where the trace file is located has a share name and can be accessed by the process that reads it in the "Monitor" environment.
    → Start the trace.

    Else (the trace is not running):
    → Create and start the trace.
    → Keep the trace number in the table.

Since we would like to have reports in the "Monitor" environment, we probably need the Database Name from production, along with the Database ID that we import in the trace results. This is why the DTS/SSIS should also import the list of databases and database IDs from production.
If we are constantly running reports in the "Monitor" environment, we would need to import the database list to a separate table and update the real database's table after the import.

Furthermore, we probably want to purge historical data so the "Monitor" database will not grow infinitely. It is recommended to add a step in the package to purge historical data from the "Monitor" database.



Targeting SQL Profiler to determine performance problems
 Home: Introduction
 Step 1: Tracing statements in SQL Server 2000
 Step 2: Tracing statements in SQL Server 2005
 Step 3: How to use SQL Trace definition
 Step 4: Script example for SQL Trace
 Step 5: SQL Trace results in SQL Profiler

ABOUT THE AUTHOR:   
Michelle Gutzait works as a senior databases consultant for ITERGY International Inc., an IT consulting firm specializing in the design, implementation, security and support of Microsoft products in the enterprise. Gutzait has been involved in IT for 20 years as a developer, business analyst and database consultant. For the last 10 years, she has worked exclusively with SQL Server. Her skills include database design, performance tuning, security, high availability, disaster recovery, very large databases, replication, T-SQL coding, DTS packages, administrative and infrastructure tools development, reporting services and more.
Copyright 2007 TechTarget

More on SearchSQLServer.com

  • Step-by-Step Guide: How to interpret performance metrics in SQL Server 2005
  • Using SQL Server Profiler with Analysis Services
  • FAQ: DTS packages in SQL Server


  • Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


    RELATED CONTENT
    SQL Server performance and tuning
    Tips for tuning SQL Server 2005 to improve reporting performance
    SQL Server errors, failures and other problems fixed from the trenches
    SQL Server database design disasters: How it all starts
    Can you shrink your SQL Server database to death?
    Parent-child dimensions in SQL Server 2005 with Analysis Services MDX
    SQL Server database design disasters: What not to do
    Tuning SQL Server performance via memory and CPU processing
    Troubleshoot Web service issues in SQL Server 2005 Reporting Services
    Ordering the results of a SQL query
    Configuring SQL Server with a changed computer name

    SQL Server data warehousing/business intelligence
    Tips for tuning SQL Server 2005 to improve reporting performance
    Parent-child dimensions in SQL Server 2005 with Analysis Services MDX
    Troubleshoot Web service issues in SQL Server 2005 Reporting Services
    Ordering the results of a SQL query
    SSIS error message due to installation problem on SQL Server 2005
    Using MDX and UDM in a SQL Server Analysis Services environment
    Configuring SQL Server with a changed computer name
    Change data capture in SQL Server 2008 improves BI reporting accuracy
    Manage traces in SQL Server 2005 Analysis Services with XMLA commands
    Tutorial: SQL Server 2005 Analysis Services

    SQL Server availability
    Licensing a standby server for SQL Server replication
    Get SQL Server log shipping functionality without Enterprise Edition
    Monitor database mirroring and replication after a SQL Server upgrade
    Upgrade live applications to SQL Server 2005 for high availability
    SQL Server high availability when upgrading to SQL Server 2005
    Tutorial: Migrating to SANs from local SQL Server disk storage
    How to restore SQL Server database to transition server during upgrade
    SQL Server memory configurations for procedure cache and buffer cache
    Upgrade Active/Active cluster to SQL Server 2005 and Windows 2003
    SQL Server backups using SAN database snapshots
    SQL Server availability Research

    RELATED GLOSSARY TERMS
    Terms from Whatis.com − the technology online dictionary
    contiguity  (SearchSQLServer.com)
    contiguous  (SearchSQLServer.com)
    drilldown  (SearchSQLServer.com)
    hashing  (SearchSQLServer.com)
    hybrid online analytical processing  (SearchSQLServer.com)

    RELATED RESOURCES
    2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
    Search Bitpipe.com for the latest white papers and business webcasts
    Whatis.com, the online computer dictionary


    HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
    About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
    SEARCH 
    TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

    TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




    All Rights Reserved, Copyright 2005 - 2008, TechTarget | Read our Privacy Policy
      TechTarget - The IT Media ROI Experts