Thor Logo dbatools

TraceFlag

Disable-DbaTraceFlag

Garry Bargsley (@gbargsley), blog.garrybargsley.com

Disable-DbaTraceFlag View Source Garry Bargsley (@gbargsley), blog.garrybargsley.com Windows, Linux, macOS Synopsis Disables globally running trace flags on SQL Server instances Description Turns off trace flags that are currently enabled globally across SQL Server instances using DBCC TRACEOFF. Useful when you need to disable diagnostic trace flags that were enabled for troubleshooting or testing without requiring a restart. Only affects flags currently running in memory - does not modify startup parameters or persistent trace flag settings.

Read more

Enable-DbaTraceFlag

Garry Bargsley (@gbargsley), blog.garrybargsley.com

Enable-DbaTraceFlag View Source Garry Bargsley (@gbargsley), blog.garrybargsley.com Windows, Linux, macOS Synopsis Enables one or more trace flags globally on SQL Server instances Description Activates trace flags at the global level using DBCC TRACEON, affecting all connections and sessions on the target SQL Server instances. Commonly used for troubleshooting performance issues, enabling specific SQL Server behaviors, or applying recommended trace flags for your environment. Changes take effect immediately but are lost after a SQL Server restart - use Set-DbaStartupParameter to make trace flags persistent across restarts.

Read more

Get-DbaTraceFlag

Kevin Bullen (@sqlpadawan)

Get-DbaTraceFlag View Source Kevin Bullen (@sqlpadawan) Windows, Linux, macOS Synopsis Retrieves currently enabled global trace flags from SQL Server instances. Description Queries SQL Server instances to identify which global trace flags are currently active, returning detailed status information for monitoring and compliance purposes. This is essential for auditing server configurations, troubleshooting performance issues, and ensuring trace flag consistency across environments. You can filter results to specific trace flag numbers or retrieve all enabled flags across multiple instances.

Read more