SQL Server Trace Flags Basics

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


About Prince Rastogi

Prince Rastogi is working as Database Administrator at Elephant Insurance, Richmond. He is having more than 8 years of experience and worked in ERP Domain, Wealth Management Domain. Currently he is working in Insurance domain. In the starting of his career he was working on SQL Server, Internet Information Server and Visual Source Safe. He is post graduate in Computer Science. Prince is ITIL certified professional. Prince likes to explore technical things for Database World and Writing Blogs. He is Technical Editor and Blogger at SQLServerGeeks.com. He is a regular speaker at DataPlatformDay events in Delhi NCR. He has also presented some in depth sessions about SQL Server in SQL Server Conferences in Bangalore.

View all posts by Prince Rastogi →

One Comment on “SQL Server Trace Flags Basics”

Leave a Reply

Your email address will not be published.