Trace not picking SQL statements

  • I ran a trace through Profiler, the SQL statements are showing up under Textdata column for all the system databases but not for the only user database that exists on the server.

    I'm getting the following lines under the textdata column for the user database.

    -- network protocol: Named Pipes set quoted_identifier on set arithabort off set numeric_roundabort off set ansi_warnings on set ansi_padding on set ansi_nulls on set concat_null_yields_null on set cursor_close_on_commit off set implicit_transact

  • What events do you have selected and do you have any filters in place aside from the default?

    David

    @SQLTentmaker

    “He is no fool who gives what he cannot keep to gain that which he cannot lose” - Jim Elliot

  • I've the following events and no filters

    SQL:BatchStarting

    SQL:BatchCompleted

    Audit Schema Object Access Event

    Existing Connection

    RPC completed

    Audit Login

    Audit Logout

  • sunny.tjk (2/10/2012)


    I've the following events and no filters

    SQL:BatchStarting

    SQL:BatchCompleted

    Audit Schema Object Access Event

    Existing Connection

    RPC completed

    Audit Login

    Audit Logout

    Unless you are looking for connection information to be collected I would remove the Audit Login / Logout and Existing Connection. Not sure why you have Audit Schema... selected.

    I would have the following to be sure that I was able to catch what you want;

    SP:Completed

    SP:StmtCompleted

    SQL:BatchCompleted

    SQL:BatchStarting

    SQL:StmtCompleted

    You can use the "Starting" version for those as well if wanted either in addition to or in place of the "Completed".

    Play around with that and see what you get. One note here but if you have a really busy server and you run a wide open profiler trace, i.e. no filters, then you may end up "flooding" profiler and you won't be able to stop the trace. So, I would recommend using some filters, maybe database id if you have a specific database you are looking for and also becoming familiar with sp_trace_setstatus in case you need to stop your profiler trace and can't.

    David

    @SQLTentmaker

    “He is no fool who gives what he cannot keep to gain that which he cannot lose” - Jim Elliot

  • Awesome!

    Thanks a lot, I got what I exactly wanted..

  • Great. Glad that worked.

    David

    @SQLTentmaker

    “He is no fool who gives what he cannot keep to gain that which he cannot lose” - Jim Elliot

  • David Benoit (2/10/2012)


    I would have the following to be sure that I was able to catch what you want;

    SP:Completed

    SP:StmtCompleted

    SQL:BatchCompleted

    SQL:BatchStarting

    SQL:StmtCompleted

    If capturing the objects in red above I would also capture the following as I like to see what was passed during the remote procedure call. It can be helpful in troubleshhoting SP activity

    RPC:Completed

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • David Benoit (2/10/2012)


    sunny.tjk (2/10/2012)


    I've the following events and no filters

    SQL:BatchStarting

    SQL:BatchCompleted

    Audit Schema Object Access Event

    Existing Connection

    RPC completed

    Audit Login

    Audit Logout

    Unless you are looking for connection information to be collected I would remove the Audit Login / Logout and Existing Connection. Not sure why you have Audit Schema... selected.

    I would have the following to be sure that I was able to catch what you want;

    SP:Completed

    SP:StmtCompleted

    SQL:BatchCompleted

    SQL:BatchStarting

    SQL:StmtCompleted

    You can use the "Starting" version for those as well if wanted either in addition to or in place of the "Completed".

    Play around with that and see what you get. One note here but if you have a really busy server and you run a wide open profiler trace, i.e. no filters, then you may end up "flooding" profiler and you won't be able to stop the trace. So, I would recommend using some filters, maybe database id if you have a specific database you are looking for and also becoming familiar with sp_trace_setstatus in case you need to stop your profiler trace and can't.

    With StmtCompleted, you can actually start losing calls as the buffer in the trace gets full. I wouldn't suggest capturing statement level stuff until people are really sure they need it. Most don't. Plus it adds just tons and tons of overhead to manage.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 8 posts - 1 through 7 (of 7 total)

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