SQL 2005 (Trace Template to capture all queries)

  • What trace template (Standard, TSQL etc) can be used to capture all the queries in a server/db?

  • The Standard Template should get you what you want. Although it is better practice to use a server-side trace for performance purposes.

    Which is pretty easy to setup. Quick step is to:

    1) Open Profiler

    2) Select Standard Template

    3) Click Run

    4) Immediately Click Stop

    5) File > Export > Script Trace Definition > SQL Server 2005...

    Save the file and then you can open it up and take out the eventClass(s) that you don't care about. Check here for a list of those: http://msdn.microsoft.com/en-us/library/ms175481(SQL.90).aspx

    This is a good SQL Tip to creating the trace as well: http://www.mssqltips.com/tip.asp?tip=1035

    Shawn Melton
    Twitter: @wsmelton
    Blog: wsmelton.github.com
    Github: wsmelton

  • If you would like to capture all the actions on the instance refer "C2 Audit Mode Option".

    HTH

    ---------------------------------------------------
    "Thare are only 10 types of people in the world:
    Those who understand binary, and those who don't."

  • I had used the std template(with hostname included). When i ran sp_databases, the trace shows it as two records; one record with duration, starttime, endtime,Reads & CPU and another record has NULL for the same. Any idea to interpret it?

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply