Enable a SQL Server Trace Flag Globally on Linux
https://www.mssqltips.com/sql-server-tip-category/226/sql-server-on-linux//
Microsoft has recently released SQL Server to run on Linux servers. Sometimes we need to enable a trace flag globally on SQL Server and in this tip I will demonstrate how to enable a SQL Server trace flag globally on Linux.
Solution
In SQL Server on Windows, if we want to enable a trace flag globally we can do it using one of two ways:
- DBCC Traceon (traceflag, -1)
- SQL Server Configuration Manager
In this tip we will see how to enable or disable trace flags in SQL Server running on Linux to use it globally.
To enable or disable a SQL Server trace flag on SQL Server on Linux, we need to use the SQL Server configuration manager utility called mssql-conf.
mssql-conf is a configuration script that installs with SQL Server vNext CTP 1.3 for Red Hat Enterprise Linux, SUSE Linux Enterprise Server and Ubuntu.
Enable a SQL Server Trace Flag Globally on Linux
First let's connect to SQL Server with sqlcmd and get all enabled trace flag information using DBCC tracestatus(-1).

To enable a trace flag on Linux we need to use the following command:
sudo /opt/mssql/bin/mssql-conf traceflag <TRACEFLAG_NO>on
Suppose we want to enable traceflag 1222 to run globally to capture deadlocks.
sudo /opt/mssql/bin/mssql-conf traceflag 1222 on

Now we need to restart the mssql service.
systemctl restart mssql-server.service

Now let's check the trace flag again to see if traceflag 1222 is enabled.

We can see here that the traceflag 1222 is enabled globally.
Enable Multiple SQL Server Trace Flags in Linux
Suppose we want to enable multiple trace flags i.e. 1204, 3205 at once. We can do so as shown in this script:
sudo /opt/mssql/bin/mssql-conf traceflag 1204 3205 on

Now let's check the trace flags again to see if these traceflags are enabled.

Disable SQL Server Trace Flags Globally in Linux
Suppose we want to disable a trace flag. We need to use the below command.
sudo /opt/mssql/bin/mssql-conf traceflag <TRACEFLAG_NO>Off
If we want to disable trace flag 3205, run the command as:
sudo /opt/mssql/bin/mssql-conf traceflag 3205 Off

Once we have restarted the SQL Server service, verify the trace flag is disabled. We cannot see the disabled trace flag 3205 here since it has been disabled.

Next Steps
- Enable and disable a traceflag as per your requirements, but do not perform these steps directly on production systems without proper testing.
- Read more about SQL Server on Linux Tips.
Enable a SQL Server Trace Flag Globally on Linux的更多相关文章
- Microsoft SQL Server Trace Flags
Complete list of Microsoft SQL Server trace flags (585 trace flags) REMEMBER: Be extremely careful w ...
- sql server trace 和 Profiler
MS SQL Server Profiler概述: MS SQL Server Profiler是SQL Trace的GUI接口,提供对SQL Server Database Engine ...
- Sql Server trace flags
Tace flag number Description -T1205 每次deadlock算法运行时,都收集相关的信息 -T1204 当deadlock算法发现死锁时才收集相关信息 -T3604 把 ...
- SQL Server on Red Hat Enterprise Linux——RHEL上的SQL Server(全截图)
本文从零开始一步一步介绍如何在Red Hat Enterprise Linux上搭建SQL Server 2017,包括安装系统.安装SQL等相关步骤和方法(仅供测试学习之用,基础篇). 一. 创 ...
- SQL Server on Red Hat Enterprise Linux
本文从零开始一步一步介绍如何在Red Hat Enterprise Linux上搭建SQL Server 2017,包括安装系统.安装SQL等相关步骤和方法(仅供测试学习之用,基础篇). 一. 创 ...
- sql server trace
http://www.cnblogs.com/zhijianliutang/p/4113911.html http://www.cnblogs.com/studyzy/archive/2009/01/ ...
- RML Utilities for SQL Server
很早以前有看到过关于使用RML Utilities工具分析SQL Trace(.trc)的文章,但一直没有具体实践.最近接管一台数据库服务器,跟踪出一批高消耗的语句,老大需要跟踪分析报表,罗列出过程( ...
- SQL Server On Linux:基于实际项目案例,总结功能支持情况及相关问题解决方案,讲如何快速完成迁移
上个月,有个朋友问我说Sql Sever向Mysql迁移有什么好的经验分享,他们公司客户明确提出不再提供Windows服务器,现在计划Mysql迁移.我说Mysql迁移成本太高了,不妨可以了解一下SQ ...
- SQL Server 监控 使用sp_trace_create
监控前言 上一节我们提到了MSSQL的基于SQL Event的监控,但是有些时候我们需要更加详细.适用于调优排错的监控.SQL Server内部运行的可见性是的查询调整.优化和综合排查成为可能!这一节 ...
随机推荐
- Android推送使用--文章集锦
Android之基于百度云推送IM Android实现推送方式解决方案 Android消息推送(一)--AndroidPn(XMPP协议)Demo版到正式上线 采用XMPP协议实现Android推送 ...
- centos7装机时更改网卡名为eth0操作
- 【Foreign】阅读 [线段树][DP]
阅读 Time Limit: 10 Sec Memory Limit: 256 MB Description Input Output Sample Input 0 10 4 10 2 3 10 8 ...
- 【BZOJ2039】【2009国家集训队】人员雇佣 [最小割]
人员雇佣 Time Limit: 20 Sec Memory Limit: 259 MB[Submit][Status][Discuss] Description 作为一个富有经营头脑的富翁,小L决 ...
- noip2014 提高组
T1 生活大爆炸版 石头剪刀布 题目传送门 就是道模拟题咯 #include<algorithm> #include<cstdio> #include<cstring&g ...
- keras_训练人脸识别模型心得
keras_cnn_实现人脸训练分类 废话不多扯,直接进入正题吧!今天在训练自己分割出来的图片,感觉效果挺不错的,所以在这分享一下心得,望入门的同孩采纳. 1.首先使用python OpenCV库里面 ...
- bzoj 2659 几何
首先考虑(0, 0)到(p, q)这条直线. y = q / p * x. sum{k = 0 to (p - 1) / 2} [q / p * k] 就是直线下方的点数.sum{k = 0 to ( ...
- bzoj 1951 lucas crt 费马小定理
首先假设输入的是n,m 我们就是要求m^(Σ(c(n,i) i|n)) mod p 那么根据费马小定理,上式等于 m^(Σ(c(n,i) i|n) mod (p-1)) mod p 那么问题的关键就 ...
- Swift 枚举(七)
http://blog.csdn.net/huangchentao/article/details/32714621 枚举 1.枚举语法 用enum并把定义放在大括号内,枚举中被定义的值是枚举的成员, ...
- letsencrypt的证书转换上传到360网站防护方法
命令:openssl 首先letsencrypt生成的证书在 letsencrypt/live/xxx.com/ 下,需要使用cert.pem和privkey.pem文件. 生成crt文件: open ...