September 13, 2013 at 9:26 am
I created some trace files with a SQL Jobs. Now that the jobs have finished & I'm finished with the trace files, I want to delete the files. I get a error stating that another process has the files. I tried restarting SQL Agent, but that didn't help. I tried using XP_delete_files, but the files are not backup files, so that didn't work either. How do I delete the files?
September 13, 2013 at 10:55 am
check if the trace is still exists.
SELECT id,status,path
FROM sys.traces
If it exists and is running(status 1) you wont be able to delete the file. Even if the trace is not running (status 0) it appears you wont be able to delete the file. I did a quick test and after stopping the trace i was unable to delete the file until I removed the trace definition.
exec sp_trace_setstatus <traceid>, 2
note: if you don't recreate your trace as part of your job then don't remove the trace as the trace definition will no longer be in you instance.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply