Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


The SQL Server Black Box


The SQL Server Black Box

Author
Message
Brian Knight
Brian Knight
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: Moderators
Points: 2151 Visits: 235
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/bknight/blackbox.asp

Brian Knight
Free SQL Server Training Webinars
avi_a
avi_a
SSC Rookie
SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)SSC Rookie (31 reputation)

Group: General Forum Members
Points: 31 Visits: 36
What about performance impact for this?
Opening a constant trace of my production server doesn't sound right..



Brian Knight
Brian Knight
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: Moderators
Points: 2151 Visits: 235
Not too bad. I noticed a 1.5% CPU performance degregation by starting the trace. Keep in mind, even though it's a SQL Trace, it's tracing minimal items.

Brian Knight
bknight@sqlservercentral.com
http://www.sqlservercentral.com/columnists/bknight

Brian Knight
Free SQL Server Training Webinars
Antares686
Antares686
SSCrazy Eights
SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)

Group: Moderators
Points: 9486 Visits: 780
Normally you don't run traces on a Production server unless you absolutely need to. However, the blck box trace is designed to be saved locally and the data is not sent across the network (network bandwidth is a major concern with traces). You usually only start a black box on a problematic server. The idea is to catch all the queries right up to the point the server fails or memory stalls. Doing this serveral times should give you a clue as to what query/queries ultimately lead to the problem. Then you have a starting point as to testing. In testing you try to recreate the symptoms again intinally. If you are able to then you break the query down to determin what wihin the query may be the cause. Other things to look at are the errors in the trace to see if any will give you an idea of maybe a bad setting or corruption in the Database. But again black box is intended to capture events on a server known to be problematic already and as such adding the trace is no real issue against performance.



plapic
plapic
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 Visits: 22
Great until you realise it only works for SQL Server 2000. Would like to see SQL Server 7.0 equivalent.



Antares686
Antares686
SSCrazy Eights
SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)

Group: Moderators
Points: 9486 Visits: 780
Look up Blockbox in SQL BOL.

Here is one excerpt and I have used it on several occasion with a previous issue on a 7 box.

quote:
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. Once the trace is started, trace information is recorded in the blackbox.trc file until the size of the file reaches 5 megabytes (MB). The trace then creates another trace file, blackbox_1.trc, and trace information is written to the new file. When the size of blackbox_1.trc reaches 5 MB, the trace reverts to blackbox.trc. Thus, up to 5 MB of trace information is always available.




Steve Jones
Steve Jones
SSC-Forever
SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)SSC-Forever (49K reputation)

Group: Administrators
Points: 49184 Visits: 18997
I wouldn't necessarily run this on every server, but those that are giving me problems I would have this ready and set it up.

Steve Jones
sjones@sqlservercentral.com
http://www.sqlservercentral.com/columnists/sjones
www.dkranch.net

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Juanita
Juanita
SSC-Addicted
SSC-Addicted (442 reputation)SSC-Addicted (442 reputation)SSC-Addicted (442 reputation)SSC-Addicted (442 reputation)SSC-Addicted (442 reputation)SSC-Addicted (442 reputation)SSC-Addicted (442 reputation)SSC-Addicted (442 reputation)

Group: General Forum Members
Points: 442 Visits: 627
Brian,
I was sampling out the code you gave and I didn't create the actual proc, STARTBLACBOX. i only wanted to issue the individual sql command in query analyzer. So i executed the 'declare' and the 'exec_sp_trace_create' line and stopped there. I noticed it did build a trace file in my data directory. I then proceeded to run the EXEC SP_TRACE_SETSTATUS line and it said i needed to declare the @traceid, so i inserted a declare statement before the exec sp_trace_setstatus and then it said that 'Procedure expects parameter '@traceid' of type 'int'.. how do i know what this @traceid value is? I know these questions are real elementary but I obviously missed the boat on this one. I guess what I'm wondering is, are you supposed to run the 2 sp _trace statements together like you did in your sample? Also, how do i stop this trace after it is started. I'm testing this all out on my test server.

Confused,
Juanita



Antares686
Antares686
SSCrazy Eights
SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)SSCrazy Eights (9.5K reputation)

Group: Moderators
Points: 9486 Visits: 780
sp_trace_create has an output parameter to fill that for you. You declare your value then run sp_trace_create to get the output and then you pass to later items.

By default at each server restart it starts at 0 so yours is probably 0. Otherwise when SQL stops it clears the traces and you have to rebuild them.



Tim Ellison
Tim Ellison
SSC Veteran
SSC Veteran (291 reputation)SSC Veteran (291 reputation)SSC Veteran (291 reputation)SSC Veteran (291 reputation)SSC Veteran (291 reputation)SSC Veteran (291 reputation)SSC Veteran (291 reputation)SSC Veteran (291 reputation)

Group: General Forum Members
Points: 291 Visits: 1
We have an intermittent problem on one production server which leads to very slow response times for users. It happens 1-2 times per week so Black Box monitoring looked like a good place to start tracking down the cause.
Problem is that the 5Mb trace files filled every 2 minutes so by the time I got to hear about the slow response from the Help Desk, the data had already been over-written !
I've found that you can create larger trace files using the following SQL code

declare @TraceID int ,@fsize bigint, @fname nvarchar(128)
select @fsize=25, @fname=''

exec sp_trace_create @TraceID output, 8, @fname,@fsize
exec sp_trace_setstatus @traceID, 1

Trace files of 25 Mb gave me enough time to take copies the trace files for investigation at a later time.



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search