join the MSSQLTips community

Today's Site Sponsor


 

SQL Compare quickly and easily compares and synchronizes SQL Server database schemas
 




Default Trace in SQL Server 2005

Written By: Jeremy Kadlec -- 11/15/2006 -- read/post comments -- print -- Bookmark and Share

Rating: (not rated yet) Rate

Problem
I have been running SQL Server 2005 server side traces to address some SQL Server 2005 performance issues.  I have noticed an unusual trace session that is running.  I know I have not been running this trace and know I have been diligent about running only a single trace to not impact performance.  So where did this trace session coming from?

Solution
SQL Server 2005 is running a default trace.  You can think of this as a replacement to the black box mode trace that could have been run in SQL Server 2000 where the last 5 MB of data is captured.  The trace's impact should be minimal to the server, but is valuable to be aware of as a DBA or Developer responsible for the server.

How can I find out if the trace is running on my SQL Server?

The simplest means to determine if the trace is running is to execute the following command:

SELECT *
FROM fn_trace_getinfo(default);
GO

What does the output indicate?

Result Set Description
Traceid Unique identifier for the trace
Property = 1 Configured trace options
Property = 2 Trace file name
Property = 3 Max file size for the *.trc file
Property = 4 Stop time for the trace session
Property = 5 Current trace status (1 = On and 0 = Off)
Value Current value for the traceid\property combination

Where is this trace file stored by default?

The trace is stored in the LOG directory for your SQL Server instance (i.e. C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\) at the root of where your SQL Server is installed.

Another alternative to determine if the trace is running is to review sp_configure.

To determine if the trace is configured to run, execute sp_configure and review the 'default trace enabled' option.  When the config_value and run_value are equal to 1, then this trace is running. 

How can I disable this default trace?

To disable the default trace from running, issue the following commands:

EXEC master.dbo.sp_configure 'allow updates', 1;
GO
EXEC master.dbo.sp_configure 'show advanced options', 1;
GO
EXEC master.dbo.sp_configure 'default trace enabled', 0;
GO
RECONFIGURE WITH OVERRIDE;
GO
EXEC master.dbo.sp_configure 'show advanced options', 0;
GO
EXEC master.dbo.sp_configure 'allow updates', 0;
GO

*** NOTE *** - When you issue these commands, the trace stops executing immediately.

Should I disable this trace?

If you were not aware of this trace running and you were not having related or suspected performance issues from this trace, I would say maybe not.  The final answer should come after reviewing the output from the trace files to determine if the data is valuable to you.  Invaluable information like login creations and drops are captured in these files.  You might also find other jewels that may answer some recent outstanding questions.  If the value of the information exceeds the potential issue from running this trace, then it should remain enabled.  I also encourage you to consider this trace as a source when troubleshooting an issue, so consider reviewing this file the next time a question goes unanswered.

How can I review the data captured in the trace files?

Let's end on an easy question.  Just navigate to the directory where the files are located i.e. C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ and double click on the files.  Profiler should load and permit you to browse the contents interactively.

Next Steps

Readers Who Read This Tip Also Read Free Live Webcast Comment or Ask Questions About This Tip


Sponsor Information
Free SQL Server performance monitoring dashboard – Idera SQL check

Increase your SQL speed and accuracy with code completion from SQL Prompt.

Make the most out of SQL Server - Guaranteed Results - Innovative SQL Server DBAs

Become a member of the MSSQLTips community

Free Whitepaper - Top Ten Steps to Secure Your SQL Server


Get Our Tips Newsletter

We keep 50,000+ SQL Server professionals informed.

Red Gate Software - SQL Backup

Need to create smaller, more reliable backups? Ensure your backups are optimized for robustness and speed with Red Gate SQL Backup Pro. Compress your backups by up to 95% and minimize disruptions to your backups caused by flaky networks with new network resilience. 'Network resilience puts SQL Backup Pro 6 at the top of the list of backup tools. It’s the cherry on top, and I definitely recommend using SQL Backup over SQL Server 2008 native backups.' William Durkin, Development DBA. Download now.

Download now!



More SQL Server Tools
SQL Compare

SQL diagnostic manager

SQL compliance manager

SQL defrag manager

SQL comparison toolset




Copyright (c) 2006-2010 Edgewood Solutions, LLC All rights reserved
privacy statement | disclaimer | copyright | advertise | write for mssqltips | feedback | about
Some names and products listed are the registered trademarks of their respective owners.


CareerQandA.com | MSSharePointTips.com | MSSQLTips.com