sp_trace_create is a SQL Server stored procedure that performs many of the actions previously executed by xp_trace_* extended stored procedures available in earlier versions of SQL Server. Use sp_trace_create instead of:
-
xp_trace_addnewqueue
-
xp_trace_setqueuecreateinfo
-
xp_trace_setqueuedestination
sp_trace_create only creates a trace definition. This stored procedure cannot be used to start or change a trace.
Parameters of all SQL Trace stored procedures (sp_trace_xx) are strictly typed. If these parameters are not called with the correct input parameter data types, as specified in the argument description, the stored procedure will return an error.
For sp_trace_create, the SQL Server service account must have Write permission on the trace file folder. If the SQL Server service account is not an administrator on the computer where the trace file is located, you must explicitly grant Write permission to the SQL Server service account.
Note: |
|---|
|
You can automatically load the trace file created with sp_trace_create into a table by using the fn_trace_gettable system function. For information about how to use this system function, see fn_trace_gettable (Transact-SQL).
|
For an example of using trace stored procedures, see How to: Create a Trace (Transact-SQL).
TRACE_PRODUCE_BLACKBOX has the following characteristics:
-
It is a rollover trace. The default file_count is 2 but can be overridden by the user using filecount option.
-
The default file_size as with other traces is 5 MB and can be changed.
-
No filename can be specified. The file will be saved as: N'%SQLDIR%\MSSQL\DATA\blackbox.trc'
-
Only the following events and their columns are contained in the trace:
-
RPC starting
-
Batch starting
-
Exception
-
Attention
-
Events or columns cannot be added or removed from this trace.
-
Filters cannot be specified for this trace.