Trace Flags (Transact-SQL)

Trace flags are used to temporarily set specific server characteristics or to switch off a particular behavior. For example, if trace flag 3205 is set when an instance of SQL Server 2005 starts, hardware compression for tape drivers is disabled. Trace flags are frequently used to diagnose performance issues or to debug stored procedures or complex computer systems.

The following table lists and describes the trace flags that are available in SQL Server 2005.


Trace flag behavior may not be supported in future releases of SQL Server.

Trace flag Description


Prints versioning information about extended stored procedure dynamic-link libraries (DLLs). For more information about __GetXpVersion(), see Creating Extended Stored Procedures.

Scope: global or session


Returns the resources and types of locks participating in a deadlock and also the current command affected.

Scope: global only


Disables lock escalation based on memory pressure, or based on number of locks. The SQL Server 2005 Database Engine will not escalate row or page locks to table locks.

Using this trace flag can generate excessive numbers of locks. This can slow the performance of the Database Engine, or cause 1204 errors (unable to allocate lock resource) because of insufficient memory. For more information, see Lock Escalation (Database Engine).

If both trace flag 1211 and 1224 are set, 1211 takes precedence over 1224. However, because trace flag 1211 prevents escalation in every case, even under memory pressure, we recommend that you use 1224. This helps avoid "out-of-locks" errors when many locks are being used.

Scope: global or session


Returns the resources and types of locks that are participating in a deadlock and also the current command affected, in an XML format that does not comply with any XSD schema.

Scope: global only


Disables lock escalation based on the number of locks. However, memory pressure can still activate lock escalation. The Database Engine escalates row or page locks to table locks if the amount of memory used by lock objects exceeds one of the following conditions:

  • Forty percent of the memory that is used by Database Engine, exclusive of memory allocation using Address Windowing Extension (AWE). This is applicable only when the locks parameter of sp_configure is set to 0.
  • Forty percent of the lock memory that is configured by using the locks parameter of sp_configure. For more information, see Setting Server Configuration Options.

If both trace flag 1211 and 1224 are set, 1211 takes precedence over 1224 However, because trace flag 1211 prevents escalation in every case, even under memory pressure, we recommend that you use 1224. This helps avoid "out-of-locks" errors when many locks are being used.

Scope: global or session


Disables parallel checking of objects by DBCC CHECKDB, DBCC CHECKFILEGROUP, and DBCC CHECKTABLE. By default, the degree of parallelism is automatically determined by the query processor. The maximum degree of parallelism is configured just like that of parallel queries. For more information, see max degree of parallelism Option.

Parallel DBCC should typically be left enabled. For DBCC CHECKDB, the query processor reevaluates and automatically adjusts parallelism with each table or batch of tables checked. Sometimes, checking may start when the server is almost idle. An administrator who knows that the load will increase before checking is complete may want to manually decrease or disable parallelism.

However, disabling parallel checking can cause a decrease in overall database performance. Decreasing the degree of parallelism increases the amount of transaction log that must be scanned. This in turn increases the demand for tempdb space and causes a nonlinear increase in the time that is required for DBCC to complete its checks. If DBCC is run with the TABLOCK feature enabled and parallelism set off, tables may be locked for longer periods of time.

Scope: global or session


By default, if a tape drive supports hardware compression, either the DUMP or BACKUP statement uses it. With this trace flag, you can disable hardware compression for tape drivers. This is useful when you want to exchange tapes with other sites or tape drives that do not support compression.

Scope: global or session


Limits the amount of information returned in error messages. For more information, see Metadata Visibility Configuration.

Scope: global only


Makes server-level metadata visible to application roles. In SQL Server 2005, an application role cannot access metadata outside its own database because application roles are not associated with a server-level principal. This is a change of behavior from earlier versions of SQL Server. Setting this global flag disables the new restrictions, and allows for application roles to access server-level metadata.

Scope: global only


Enables a dedicated administrator connection (DAC) on SQL Server Express. By default, no DAC resources are reserved on SQL Server Express. For more information, see Using a Dedicated Administrator Connection.

Scope: global only


In SQL Server 2005, there are two types of trace flags: session and global. Session trace flags are active for a connection and are visible only to that connection. Global trace flags are set at the server level and are visible to every connection on the server. Some flags can only be enabled as global, and some can be enabled at either global or session scope.

The following rules apply:

  • A global trace flag must be enabled globally. Otherwise, the trace flag has no effect. We recommend that you enable global trace flags at startup, by using the -T command line option.
  • If a trace flag has either global or session scope, it can be enabled with the appropriate scope. A trace flag that is enabled at the session level never affects another session, and the effect of the trace flag is lost when the SPID that opened the session logs out.

Trace flags are set on or off by using either of the following methods:

  • Using the DBCC TRACEON and DBCC TRACEOFF commands.
    For example, DBCC TRACEON 2528: To enable the trace flag globally, use DBCC TRACEON with the -1 argument: DBCC TRACEON 2528, -1. To turn off a global trace flag, use DBCC TRACEOFF with the -1 argument.
  • Using the -T startup option to specify that the trace flag be set on during startup.
    The -T startup option enables a trace flag globally. You cannot enable a session-level trace flag by using a startup option. For more information about startup options, see Using the SQL Server Service Startup Options.

Use the DBCC TRACESTATUS command to determine which trace flags are currently active.

Behavior Changes

In SQL Server 2000, a simple DBCC TRACEON (1204) is enough to enable deadlock reporting to the error log. In SQL Server 2005, you must enable the flag globally because the session-level flag is not visible to the deadlock monitor thread.

For more information about changes in behavior, see Breaking Changes to Database Engine Features in SQL Server 2005.


The following example sets trace flag 3205 on by using DBCC TRACEON.

DBCC TRACEON (3205,-1)

See Also


Data Types (Transact-SQL)
EXECUTE (Transact-SQL)
SELECT (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance

Change History

Release History

15 September 2007

Changed content:
  • Corrected scope information for trace flag 1224.

14 April 2006

New content:
  • Added the description for trace flag 7806.
  • Added information about preference for trace flag 1224 over 1211.
  • Added scope information for each trace flag.
  • Added behavior changes.

5 December 2005

New content:
  • Added the description for trace flags 4616 and 3625.