zoukankan      html  css  js  c++  java
  • 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      0
    4616      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 FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLDATAmaster.mdf;-eC:Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLLogERRORLOG;-lC:Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLDATAmastlog.ldf
    

    After modification

    -dC:Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLDATAmaster.mdf;-eC:Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLLogERRORLOG;-lC:Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLDATAmastlog.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)

  • 相关阅读:
    内存可用性判断 IsBadCodePtr IsBadReadPtr 等等
    部署到Linux使用VS Code 开发.NET Core 应用程序
    Gulp.js简介
    net WebApi中使用swagger
    深入理解
    软件框架
    重拾linux
    Linux创建修改删除用户和组
    Linux 之 rsyslog
    Lua 解释器
  • 原文地址:https://www.cnblogs.com/zengkefu/p/6954172.html
Copyright © 2011-2022 走看看