October 7, 2002 at 9:43 pm
1. Does anyone use the Blackbox trace?
2. Does anyone know how to get this working?
Books Online:
Use sp_trace_create with the TRACE_PRODUCE_BLACKBOX option to define a trace that appends trace information to a blackbox.trc file in the \Data directory.
--- I cannot get sp_trace_create to compile.
Anyone have an example?
October 8, 2002 at 1:04 am
Something like this?
DECLARE @Retval int, @TraceID int, @Message varchar(100)
EXEC @Retval = sp_trace_create @TraceID OUTPUT, 8
IF @Retval = 0
BEGIN
SET @Message = 'Blackbox trace created. TraceID=' + CONVERT(varchar(12), @TraceID)
EXEC sp_trace_setstatus @TraceID, 1
END
ELSE
BEGIN
SET @Message = 'Failed to create blackbox trace. Error code=' + CONVERT(varchar(12), @Retval) + ' , TraceID=' + CONVERT(varchar(12), @TraceID)
END
PRINT @Message
--
Chris Hedgate @ Apptus Technologies (http://www.apptus.se)
Edited by - chrhedga on 10/08/2002 01:10:00 AM
October 8, 2002 at 3:50 am
chrhedga does go a little overboard there. All you actually need is
DECLARE @traceid int
EXEC sp_trace_create @traceid OUTPUT, 8
PRINT @traceid
The traceId will allow you to shut it off without bouncing the server later if need to. However, I generally use this when the server fails for unknown reasons and leave it active until the server halts or is overburdened to the point it seems to have stalled. Then afterwards I review it to see if anything speciifc may have happened in the minutes before. Sometimes you will not find what you are looking for so it helps to keep copies after each failure for 2 or 3 failures to get a common occurrance between them.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
October 8, 2002 at 5:05 am
Yep, I copied the code from a proc I have, so that's why it was more than necessary. But won't the trace be stopped (or rather never started) if you don't execute sp_trace_setstatus?
--
Chris Hedgate @ Apptus Technologies (http://www.apptus.se)
October 8, 2002 at 5:56 am
chrhedga, you are right there, I am used to doing this on 7 more than 2000.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply