Skip to content

Latest commit

 

History

History
116 lines (82 loc) · 4.03 KB

dbcc-tracestatus-transact-sql.md

File metadata and controls

116 lines (82 loc) · 4.03 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
DBCC TRACESTATUS (Transact-SQL)
DBCC TRACESTATUS displays the status of trace flags.
rwestMSFT
randolphwest
12/05/2022
sql
t-sql
language-reference
DBCC_TRACESTATUS_TSQL
DBCC TRACESTATUS
TRACESTATUS_TSQL
TRACESTATUS
global trace flags [SQL Server]
status information [SQL Server], trace flags
trace flags [SQL Server], status information
DBCC TRACESTATUS statement
session trace flags [SQL Server]
displaying trace flag status
TSQL

DBCC TRACESTATUS (Transact-SQL)

[!INCLUDE SQL Server - ASDBMI]

Displays the status of trace flags.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

DBCC TRACESTATUS ( [ [ trace# [ , ...n ] ] [ , ] [ -1 ] ] )
[ WITH NO_INFOMSGS ]

[!INCLUDEsql-server-tsql-previous-offline-documentation]

Arguments

trace#

The number of the trace flag for which the status is displayed. If trace#, and -1 are not specified, all trace flags that are enabled for the session are displayed.

n

A placeholder that indicates multiple trace flags can be specified.

-1

Displays the status of trace flags that are enabled globally and for the current session. If -1 is specified without trace#, all trace flags including session enabled are returned.

WITH NO_INFOMSGS

Suppresses all informational messages that have severity levels from 0 through 10.

Result sets

The following table describes the information in the result set.

Column name Description
TraceFlag Name of trace flag
Status Indicates whether the trace flag is set ON of OFF, either globally or for the session.

1 = ON

0 = OFF
Global Indicates whether the trace flag is set globally

1 = True

0 = False
Session Indicates whether the trace flag is set for the session

1 = True

0 = False

DBCC TRACESTATUS returns a column for the trace flag number and a column for the status. This indicates whether the trace flag is ON (1) or OFF (0). The column heading for the trace flag number is either Global or Session, depending on whether you are checking the status for a global or a session trace flag.

Remarks

There are two types of trace flags in [!INCLUDE ssnoversion-md], session and global. Session trace flags are active for a connection and are visible only for that connection. Global trace flags are set at the server level and are visible to every connection on the server.

Permissions

Requires membership in the public role.

Examples

The following example displays the status of all trace flags that are currently enabled globally.

DBCC TRACESTATUS (-1);
GO

The following example displays the status of Trace Flags 2528 and 3205.

DBCC TRACESTATUS (2528, 3205);
GO

The following example displays whether Trace Flag 3205 is enabled for the current session or globally.

DBCC TRACESTATUS (3205, -1);
GO

The following example lists all the trace flags that are enabled for the current session.

DBCC TRACESTATUS ();
GO

See also