Cannot create a new trace

  • Hi,

    When I try to create a new trace I keep getting the error message "Msg 19067, Level 16, State 1, Procedure sp_trace_create, Line 1

    Cannot create a new trace because the trace file path is found in the existing traces."

    If I change the trace file name then it works but I want to programatically set the filename to something like 'trace_date_time' but it only seems to allow one trace to be named before you have to change the start of the trace filename. I also can't delete the old trace files from the file system or remove them from sys.traces. I can only set the status to zero.

    Any help would be much appreciated.

    Thanks.

  • Create a random file name each time when you start your trace, this will solve the problem 🙂

  • Thanks but not very useful when trying to remember what the file is a few months down the line! This was working until yesterday so I don't know what's stopping it from working now.

  • Why cant u crate a file name with dates on it that will be helpful to identify the files after a few days or months, there is a option in trace, to create a new file after the current file has reached a size, i think that this is the problem, when it tries to create a file name, the file already exists. 🙂

  • to delete a trace you have to stop and close it

    exec sp_trace_setstatus traceid, 0 --stop trace

    exec sp_trace_setstatus traceid, 2 --close trace

    all of this is no good until you know the traceid, get this by using

    select * from ::fn_trace_getinfo(default)

    each active trace will return 5 five rows, property 5 indicates started, stopped or closed

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

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

  • Thanks Perry! That was it. I was stopping the trace but not closing it.

  • your welcome

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

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

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

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