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内部运行的可见性是的查询调整.优化和综合排查成为可能!这一节 ...
随机推荐
- IE9,IE10 CSS因Mime类型不匹配而被忽略问题 (转)
写页面的时候在chrome,fireforks等页面上显示正常,但是换成IE9,IE10之后就完全没有样式了,报错信息是CSS 因 Mime 类型不匹配而被忽略,下面与大家分享下这个问题的相关的回答 ...
- struts2学习问题(一)
一.struts2 Unknown tag (s:property). 解释:不识别标签 解决:这是sturts2的标签,导入相应的包<%@taglib prefix="s" ...
- 浏览器web端详解
一.背景介绍浏览器是前端工程师或页面重构师工作中必不可少的,WEB页面运行在各种各样的浏览器当中,浏览器载入.渲染页面的速度直接影响着用户体验,特别是浏览器渲染页面的原理,页面渲染就是浏览器将HTML ...
- 【uva1380 - 一个调度问题】思路题+树形dp
[题意] 有n<=200个恰好需要一天完成的任务,要求用最少的时间完成所有任务.任务可以同时完成.但是有一些约束,分有向和无向两种,其中A-->B表示A必须在B前面完成,而A--B表示A和 ...
- 【BZOJ2039】【2009国家集训队】人员雇佣 [最小割]
人员雇佣 Time Limit: 20 Sec Memory Limit: 259 MB[Submit][Status][Discuss] Description 作为一个富有经营头脑的富翁,小L决 ...
- stdafx.h、stdafx.cpp的作用
这两个文件用于建立一个预编译的头文件".PCH"和一个预定义的类型文件"STDAFX.OBJ".由于MFC体系结构非常大,各个源文件中都包含许多头文件,如果每次 ...
- js判断浏览器是否为ie
使用传统方式 if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Op ...
- Opencv 中透视变换函数对IplImage图像变换时出现的问题?
最近一直在做视频稳像的项目,为了简化部分实现,使用了部分Opencv的函数,其中包括Opencv中对IplImage进行同时变换的函数cvWarpPerspective(src, dst,...) 发 ...
- Codeforces 106 DIV2 ACD
B表示完全看不懂..就不弄了.. E字符串先不管了.到时候系统学下字符串再处理 A #include <map> #include <set> #include <lis ...
- You have not concluded your merge. (MERGE_HEAD exists)(转)
Git本地有修改如何强制更新 本地有修改和提交,如何强制用远程的库更新更新.我尝试过用git pull -f,总是提示 You have not concluded your merge. (MERG ...