How to CHECK if ACTIVE TRACE FLAGS on MICROSOFT SQL SERVER

Source: Internet
Author: User
Tags mssql mssqlserver

Http://crashmag.net/how-to-check-for-active-trace-flags-on-microsoft-sql-server

You check for active trace flags by running the following query. They may is global or they may session based.

Checking for active trace flags
DBCC Tracestatus

The output could is something like the following.

Traceflag Status Global Session----------------------------4199      1      1      04616      1      1      0 (2 row (s) Affected) DBCC execution completed. If DBCC printed error messages, contact your system administrator.

If There is no active trace flags you'll only see

DBCC execution completed. If DBCC printed error messages, contact your system administrator.
Enable session based Trace flags

To enable trace flags only in your session with the following-commands.

DBCC TRACEON (trace#) DBCC TRACEOFF (trace#)

trace#
Is the number of the "Trace flag to turn" on.

Enable Trace Flags globally
DBCC TRACEON (TRACE#,-1) DBCC TRACEOFF (TRACE#,-1)

-1
Switches on the specified trace flags globally.

To enable a trace flag to persist through a restart. Alter the "Startup Parameters" in the Advanced tab for the SQL Server service in SQL Server Configuration Manager.

One example would be.

Before modification
-dc:\program Files\Microsoft SQL Server\mssql10. Mssqlserver\mssql\data\master.mdf;-ec:\program Files\Microsoft SQL Server\mssql10. Mssqlserver\mssql\log\errorlog;-lc:\program Files\Microsoft SQL Server\mssql10. Mssqlserver\mssql\data\mastlog.ldf
After modification
-dc:\program Files\Microsoft SQL Server\mssql10. Mssqlserver\mssql\data\master.mdf;-ec:\program Files\Microsoft SQL Server\mssql10. Mssqlserver\mssql\log\errorlog;-lc:\program Files\Microsoft SQL Server\mssql10. mssqlserver\mssql\data\mastlog.ldf;-t4199

sqlservr [-sinstance_name] [-c] [-dmaster_path] [-f]
[-eerror_log_path] [-lmaster_log_path] [-M]
[-N] [-ttrace#] [-V] [-X] [-gnumber] [-h]

References

DBCC TRACEON (Transact-SQL)
DBCC traceoff (Transact-SQL)
DBCC tracestatus (Transact-SQL)
Trace Flags (Transact-SQL)

How to CHECK if ACTIVE TRACE FLAGS on MICROSOFT SQL SERVER

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.