Search

Friday, February 3, 2012

Enable, Disable Trace Flag

Trace flags are required for temporary purpose to analyze server level characteristics or behaviors during a course of action. It helps the developers to troubleshoot the server. 


We can enable/ disable trace flag in many ways. We can Enable/disable through
1. Adding in startup parameter
2. Adding in Registery
3 DBCC TraceOn/TraceOff


Here I am describing TraceOn only


Enable Trace Flag
You can use DBCC TraceOn to enable trace flag for a single session so that it wont work in another session.


DBCC TraceOn(abcd)


You can also use DBCC TraceOn to enable trace flag globally so that it will be effective in all sessions.


DBCC TraceOn(abcd,-1)


Disable Trace Flag
You can use DBCC TraceOff to disable trace flag for a single session


DBCC TraceOff(abcd)


You can also use DBCC TraceOff to disable trace flag globally so that it will be effective in all sessions.


DBCC TraceOff(abcd,-1)


Check Trace Flag Status
To know the status of any trace flag whether its turned on you can use the below command

To check individual trace flag status use the below command
DBCC TraceStatus(abcd)
To check status of all trace flag use the below command
DBCC TraceStatus(-1)


NOTE: Here abcd is Trance Flag Number

No comments:

Post a Comment