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内部运行的可见性是的查询调整.优化和综合排查成为可能!这一节 ...
随机推荐
- Spring Session使用及源码解析
参照: http://blog.csdn.net/wojiaolinaaa/article/details/62424642 总结点spring session的一些知识点: spring通过过滤器, ...
- 【BZOJ2301】【HAOI2011】Problem b [莫比乌斯反演]
Problem b Time Limit: 50 Sec Memory Limit: 256 MB[Submit][Status][Discuss] Description 对于给出的n个询问,每次 ...
- [bzoj3224]Tyvj 1728 普通平衡树——splay模板
题目 你需要写一种数据结构支援以下操作. 插入元素. 删除元素. 查询元素的排名. 查询第k小的元素. 查询元素前趋. 查询元素后继. 题解 BBST裸题. 代码 #include <cstdi ...
- [Leetcode Week10]Minimum Time Difference
Minimum Time Difference 题解 原创文章,拒绝转载 题目来源:https://leetcode.com/problems/minimum-time-difference/desc ...
- 利用cron监视后台进程状态
利用cron监视后台进程状态 http://blog.csdn.net/dyx810601/article/details/72967758 1. 利用cron监视后台进程状态,如果进程死掉或服务器重 ...
- 【bzoj3227】红黑树
神TM的红黑树,其实本质上应该还是一种树dp的问题…… 一开始想了一个比较裸的树dp,后来发现还有更强的做法. 每个前端黑节点是看作一个物品,然后这就是很典型的树形dp的问题. 不过可以这么考虑,考虑 ...
- 【 Linux 】I/O工作模型及Web服务器原理
一.进程.线程 进程是具有一定独立功能的,在计算机中已经运行的程序的实体.在早期系统中(如linux 2.4以前),进程是基本运作单位,在支持线程的系统中(如windows,linux2.6) ...
- Appium+python自动化29-toast消息【转载】
本篇转自博客:上海-悠悠 前言 appium1.5以后的版本才支持toast定位,并且 'automationName'得设置为'Uiautomator2',才能捕获到. 一. Supported P ...
- w3cschool javascript学习
name与Id属性区别 1.我们知道在网页做Post提交时,是以Form(即表单域)为单位进行提交的,一个Form里有若干个表单对象(如<input type="text" ...
- 基于percona-monitoring-plugins实现Zabbix的MySQL多端口自动发现监控
https://blog.csdn.net/u013820054/article/details/50931793