having trouble with sp_trace_create

  • Greetings all,

    I am working on trying to get a series of trace events to run in the background and I am having trouble with sp_trace_create. Below is my code. I am getting back a return code of 12 and I cannot understand why I am getting this error. I have full admin rights to the database. Any help would be appreciated.

    declare @rc int, @TraceID int

    declare @maxfilesize bigint

    set @maxfilesize = 5

    exec @rc = sp_trace_create @TraceID output, 2, N'c:\profiledumps\testtrace', @maxfilesize, NULL

    if (@rc != 0) goto error

    Sincerely,

    Patrick Quinn

  • Make sure the "profiledumps" directory exists on the C: drive.

  • Did you create this script with profiler? or you manually created it? Wich what user are you running the sp?

  • I created the whole script with Profiler. I am using the user account with full system admin privileges. Does the SQL Server engine need some kind of access privileges to the profiledumps folder? It was a folder I created on my own.

  • Shouldn't be that but to test if it can read the folder at least do

    xp_cmdshell 'dir c:\profiledumps'

    If it cannot access it it will tell you why.

    Also, when you say you created it, do you mean it exists on your local machine or the machine where SQL server is installed (if not the same as your local machine). If not the same location as the SQL Server install then the folder doesn't exist on the server for it to access. When you create a trace this way all information is in relation to the installation location of SQL.

  • I got it all working. It was a permissions issue through SQL Agent. Thanks for your all your help.

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

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