SQL Trace

  • Does anyone know if there is a limit to the number of roll over files that a trace can generate?  For example I create a trace that writes to a file named mytrace.trc after some time that file fills and file myTrace_1.trc is created.  Eventualy n files are created and I have myTrace_n-1.trc.  Is there a limit to how big n can become assuming there is enough disk space to hold the files?

  • I don't believe there is. I don't recall one and we've run a lot of traces over the year. How many rollovers were you considering?

    K. Brian Kelley
    @kbriankelley

  • Potentially lots, but I don't have a number.  I have a trace runs on high volume servers that are rarely re-started.  The trace begins when SQL Server is started and will shutdown SQL Server if it can not write the trace data to disk.  It creates a new base file name when it starts.  I couldn't find the number of files documented anywhere and was wondering if anyone knew the limit or had run into a problem with the traces not rolling over after some number of files have been generated.

  • Peter,

    What are your requirements for the trace retaining period? Is the machine backed up every day so trace files could go to tape? In this case I would consider adding a stop date to the trace:

    select @stop=getdate()+10

    select @maxsize=5

    EXEC @rc = sp_trace_create @traceid=@Trace_ID output,

     @options=2, @tracefile=N'E:\TraceFiles\Trace1',@maxfilesize=@maxsize, @stoptime = @stop

    And after that I would restart the trace. If you have the requirement that the trace should be running all the times, then I would have a second trace that would be working while the first trace being restarted.

     

    Regards,Yelena Varsha

  • Thanks Yelena.  The requirements vary for different evironments.  The trace must be running at all times so they would have to overlap.   

Viewing 5 posts - 1 through 5 (of 5 total)

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