HOW TO CHECK FOR ACTIVE TRACE FLAGS ON MICROSOFT SQL SERVER

來源:互聯網
上載者:User

標籤:msdn   ast   status   art   stl   put   message   service   href   

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 be global or they may be session based.

Checking for active trace flags
DBCC TRACESTATUS

The output could be 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 are no active trace flags you will 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 use the following two 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 FOR ACTIVE TRACE FLAGS ON MICROSOFT SQL SERVER

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.