Determine if SQL TRACE is active

  • What is the best / easiest way to determine if a SQL TRACE is running on a SQL Server 2000 machine?

    thx in advance 

    BT
  • Run sp_who2 and look in the programname column.  If SQL Profiler exists, someone is running a trace.  You can then track it down by using hostname and login.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • My alter ego found this:

    DBCC TRACESTATUS 

    You can use DBCC TRACESTATUS command to get the status information for a particular trace flag(s) currently turned on. This is the syntax from SQL Server Books Online:

    DBCC TRACESTATUS (trace# [,...n])

    To get a status information for all trace flags currently turned on, you can use -1 for trace#.

    Example:

    DBCC TRACESTATUS(-1)

    You can use DBCC TRACEON command to turn on the specified trace flag. This is the syntax from SQL Server Books

    Online:

    DBCC TRACEON (trace# [,...n])

    If you want to turn off the specified trace flag(s), you can use DBCC TRACEOFF command. This is the

    syntax from SQL Server Books Online:

    DBCC TRACEOFF (trace# [,...n])

    1. Trace flag -1 (undocumented).

    This trace flag sets trace flags for all client connections, rather than for a single

    client connection. Is used only when setting trace flags using DBCC TRACEON and DBCC TRACEOFF.

    The setting of the Trace flag -1 is not visible with DBCC TRACESTATUS command, but work without problems.

     

    BT
  • Ah, my bad.  You wanted to know about trace flags, not a SQL trace via profier.  Sounds like you've found what you need.  Have a good one....

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

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

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