This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing a script to enable and disable default trace in SQL Server.
SQL Server 2005 introduces this default trace.
Using default trace, we can capture different events of SQL Server like errors, objects changes etc.
You can also run this trace file using SQL Server Profiler.
The Default location of this trace file is C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\.
Default trace enabled by default, but as per the requirement, we can disable or enable it.
Below is a script to disable default trace :
1 2 3 4 5 6 7 8 9 10 11 12 |
EXEC sp_configure 'show advanced options', 1; GO RECONFIGURE; GO EXEC sp_configure 'default trace enabled', 0; GO RECONFIGURE; GO EXEC sp_configure 'show advanced options', 0; GO RECONFIGURE; GO |
Below is a script to enable default trace :
1 2 3 4 5 6 7 8 9 10 11 12 |
EXEC sp_configure 'show advanced options', 1; GO RECONFIGURE; GO EXEC sp_configure 'default trace enabled', 1; GO RECONFIGURE; GO EXEC sp_configure 'show advanced options', 0; GO RECONFIGURE; GO |