Black Box Trace In SQL Server
- 3
- Add a Comment
The other day I was looking on a production SQL Server and I noticed a trace file that was running but was not able to associate it to SQL Profile session. I queried sysprocesses and was unable to find a spid that was running SQL Profile. I was perplexed for a little while and started searching the Internet high and low and came across “black box” traces in SQL Server.
So what I did was… I opened up the trace file in SQL Profiler and I was able to view the events and columns for the trace. Then I compared the events and columns to what I found in the trace file to what I found on the Internet. The comparison turned out to be an exact match for events as well as columns. So I started asking around and nobody seemed to know how it got there on the server and if it was being used. Of course when it comes to something like this nobody wants to fess up.
Here is the idea of a “black box” trace. A black box trace records the last 5MB of activity on the SQL Server when it becomes problematic. The trace captures the queries and\or errors right before the server becomes unrepsonsive or crashes. This information is useful for sending to Microsoft to help diagnose the problem. The black box trace records the following:
Stored Procedure Execution (RPC:Starting)
T-SQL Batch Execution (SQL:BatchStarting)
Errors and Warnings (Attention and Exception)
You can go to google and query “sql server black box trace” and you will get a lot more information. From what I have read and I can tell on my own server the black box trace does not cause any performance issues. If you have experience using the black box trace feature please post and let us know!

3 Comments
André van de Graaf
March 19th, 2009
at 12:53am
I have used it 2 times on our production environment to find the query on which SQL server was crashing. It works really good. I didn’t find substantial overhead of the black box trace. But even it has some additional overhead it was is really worth. The crashes of SQL server were unacceptable. With this black box trace we were able to find the query on which SQL crashes. Knowing the query we could make repro for Micirosoft. We temporary changed the query a little bit till Micirosft had made a hot fix for us.
sqlsquirrel
March 20th, 2009
at 10:31pm
Thank you for the feedback Andre!… I had run into the same issue where a particular query was crashing SQL Server. After research and working with Microsoft support we were able to run the black box trace and identify the problematic query. I agree with some additional overhead it was really worth running this trace!
Pinneys
June 15th, 2009
at 11:37am
This is nice review, i will try to use it. Thanks.
Regards,
cafemarly.com
aptsoft.net
anytimeairportshuttle.com
pinneysestate.com