How to enable 'default trace enabled'

What is the default trace?

A default installation of SQL Server 2005/2008 results in a lightweight server-side trace running continuously in the background.
The trace records a handful of events to a trace file which can be loaded up and reviewed in SQL Profiler, just the same as any other trace file.
By default, five trace files are kept in the same folder as the SQL Server error log. Each file has a size limit of 20MB before it rolls over to the next file. After the fifth file is filled, the default trace rolls over to the first file, and so on.


To confirm if the trace is enabled, run the following query:
sp_configure 'default trace enabled'

A run_value of 1 indicates the default trace is enabled and should be active.

If the trace is enabled, the following query will list the details:
select * from sys.traces where is_default = 1

Amongst the output will be confirmation that the trace is running (is_shutdown will be set to 0 if it is running, otherwise it will be 1). The path column will show the full path and name of the current default trace output file.

How to enable 'default trace enabled'

sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'default trace enabled';
GO
RECONFIGURE;
GO

原文地址:https://www.cnblogs.com/holly/p/1672140.html