Hi Friends,

I am going to start a series on SQL Server Trace Flags. So in my first blog I want to put some light on the introduction and how to use trace flags.

Introduction: Trace flags are like a checkpoint. Enabling a trace flag is like we enabled or disabled a part of code that can do something useful for us. We can also use various trace flags for troubleshooting purpose. In simple words you can say that trace flags are like settings which can change the behaviour of sql server default working.

How to use: we can enable a trace flag by using below methods

1-      DBCC TRACEON command to enable and DBCC TRACEOFF command to disable. By using this option we can enable a trace flag at session level or global level.

To enable at session level we will use DBCC TRACEON (trace flag number)

To enable at global level we will use DBCC TRACEON (trace flag number,-1)

In similar way, you can also disable a trace flag by using DBCC TRACEOFF ().

2-      Using –T startup option. By using this we can enable a trace flag at sql service startup level.

Always use –T uppercase letter.

  • Go to Start -> Click on Microsoft SQL Server 20xx-> Configuration Tools -> click on  SQL Server Configuration Manager
  • Click on SQL Server Services in Right Pane.
  • Double click to open properties on SQL Server service
  • Now Click on Advanced Tab
  • Here you can add ‘;-Txxxx’ at the end of Start up Parameter Value. (Replace xxxx with trace flag number)

PS: Do not use trace flags in production environment without testing it on non production environments and without consulting because everything comes at a cost.


Prince Kumar Rastogi

Like us on FaceBook | Join the fastest growing SQL Server group on FaceBook

Follow Prince Rastogi on Twitter | Follow Prince Rastogi on FaceBook