Enable or Disable Trace Flags Globally on SQL Server on Linux

You can enable or disable trace flag at the session level for analyzing something, or at the server level for all connections. In this blog, we shall see how to enable or disable trace flags in SQL Server on Linux for the startup of the SQL Server service so that it can be used globally.

Enable Trace Flags 

  • Connect your Linux machine as a root user

Syntax: sudo -i

01connectasrootuser

01defaultglobaltraceflag

  • Enable a trace flag by running below command. For example, I am going to enable trace flag 3604.

Syntax: /opt/mssql/bin/mssql-conf traceflag <traceflagNumber1> on

02

  • You can enable multiple trace flags by specifying them separately. For example, I am going to enable trace flag 1118 and 1117 in one shot.

Syntax: /opt/mssql/bin/mssql-conf traceflag <traceflagNumber1> <traceflagNumber2>on

03

  • Once you enable the global trace flag, It will ask you restart the SQL Server service

Syntax: systemctl restart mssql-server

04restartthesqlserverservice

  • Check out all enabled global trace flags

04

You can see the trace flags 3604, 1117 and 1118 are enabled globally now.

Disable Trace Flags 

  • You can disable one or more enabled trace flags in one attempt by specifying them. For example, I am going to disable trace flag 3604, 1118 and 1117 in one attempt.

Syntax: /opt/mssql/bin/mssql-conf traceflag 3604 1118 1117 off

05disabletheglobaltraceflag

  • Once you disable the global trace flag, It will ask you restart the SQL Server service

Syntax: systemctl restart mssql-server

04restartthesqlserverservice

  • Verify the disabled trace flags are still active or not.

06verifythedisabledtraceflag

Now, we cannot see the disabled trace flags 3604, 1117 and 1118. It means the trace flag are no more active on the server. Please do comment, if you have any question regarding trace flag on SQL Server on Linux

Leave a comment

Your email address will not be published. Required fields are marked *