转储sql文件

In this article, we will talk about SQL Dump files and the process to change the dump directory in Linux SQL Server.

在本文中,我们将讨论SQL Dump文件以及在Linux SQL Server中更改转储目录的过程。

Dumps in SQL Server help to investigate system crashes or other exceptions in SQL Server instances. You might have experienced a Microsoft CSS asking to upload the dumps while working on troubleshooting on an issue. We can do the analysis, ourselves, based on the dumps which will give you information about the things running during that time. We have seen below types of dumps in the SQL Server.

SQL Server中的转储有助于调查SQL Server实例中的系统崩溃或其他异常。 在解决问题时,您可能会遇到Microsoft CSS要求上传转储的问题。 我们可以根据转储自己进行分析,这将为您提供有关这段时间运行的信息。 我们已经在SQL Server中看到以下类型的转储。

  1. Mini Dump: this gives the basic information on the SQL Server stack. We do not get information about the data pages or the index pages. This dump is enabled by default in SQL Server 小型转储:提供有关SQL Server堆栈的基本信息。 我们没有获得有关数据页或索引页的信息。 默认情况下,在SQL Server中启用此转储
  2. Full Dump: In the full dump, SQL Server captures the entire process memory dump. We get information about the hashed and the stolen pages as well. We need to enable this using trace flag 2544 (DBCC TraceOn 2544, -1) 完全转储:在完全转储中,SQL Server捕获整个进程内存转储。 我们还获得有关散列页面和被盗页面的信息。 我们需要使用跟踪标志2544(DBCC TraceOn 2544,-1)启用此功能
  3. Filtered Dump: in the filtered dump, we get information about all structures and the stolen buffers. We need to enable this using trace flag 2551 (DBCC TraceOn 2551, -1) 过滤的转储:在过滤的转储中,我们获取有关所有结构和被盗缓冲区的信息。 我们需要使用跟踪标志2551(DBCC TraceOn 2551,-1)启用它
  4. Exception Dumps: if there is an exception in the SQL Server processes, we get this dump. You can use the undocumented command DBCC DUMPTRIGGER to create a dump on any particular error 异常转储:如果SQL Server进程中存在异常,则得到此转储。 您可以使用未记录的命令DBCC DUMPTRIGGER创建针对任何特定错误的转储

You might find multiple dump files in the log folder in the extension of *.mdmp,*.txt, and *.log files.

您可能会在* .mdmp,*。txt和* .log文件扩展名的日志文件夹中找到多个转储文件。

  • Memory Dump: We get memory dump files with the format of SQLDump<nnnn>.mdmp. It is the memory dump of the SQL Server process generated during an issue. Microsoft requires these dump files to investigate the issue 内存转储:我们以SQLDump <nnnn> .mdmp的格式获取内存转储文件。 它是问题期间生成SQL Server进程的内存转储。 Microsoft需要这些转储文件来调查问题
  • Dump file: We these files in the format of SQLDump<nnnn>.txt that contains environmental information 转储文件:这些文件采用SQLDump <nnnn> .txt格式,包含环境信息
  • Error log file: Another file is generated in the format of SQLDump<nnnn>.txt, which contains a snapshot of the error log when the dump was generated. We can look at the information in the error log as well however if the error log is recycled, this snap can help to troubleshoot the issue 错误日志文件:另一个文件以SQLDump <nnnn> .txt的格式生成,其中包含生成转储时错误日志的快照。 我们也可以查看错误日志中的信息,但是,如果错误日志被回收,此快照可以帮助解决问题

Below are the few conditions in which we can see a minidump generated by the SQL Server.

下面是几个可以查看由SQL Server生成的小型转储的情况。

  • Non-Yielding scheduler 非收益调度器
  • Non-yielding resource monitor 非收益资源监控器
  • Non-yielding IOCP listener 不屈服的IOCP侦听器
  • Latch Timeout 锁存超时
  • Deadlocks Schedulers 死锁调度程序
  • DB Corruption 数据库腐败
  • Process exceptions 流程例外

In SQL Server on a Windows environment, we can go to SQL Server Configuration Manager. In the SQL Server service properties, we can look and change the path the dump directory in the advanced section as shown below.

在Windows环境中SQL Server中,我们可以转到SQL Server配置管理器。 在SQL Server服务属性中,我们可以在高级部分中查找并更改转储目录的路径,如下所示。

By default, Dump directory is ‘C:\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\LOG\’ in Windows system.

默认情况下,在Windows系统中,转储目录为“ C:\ Microsoft SQL Server \ MSSQL10_50.MSSQLSERVER \ MSSQL \ LOG \”。

You can set up SQL Server 2019 on Ubuntu Linux by following up the article, SQL Server 2019 installation on Ubuntu without a Docker Container.

您可以通过遵循文章在没有Docker Container的Ubuntu上安装SQL Server 2019的文章来在Ubuntu Linux上设置SQL Server 2019。

在Linux上SQL Server中转储文件位置 (Dump files location in SQL Server on Linux)

I will assume that you have installed SQL Server 2019 on Ubuntu Operating system. First, check the status of the SQL Server services using the below command.

我将假定您已在Ubuntu操作系统上安装了SQL Server 2019。 首先,使用以下命令检查SQL Server服务的状态。

Command:

命令:

$ sudo systemctl status mssql-server

$ sudo systemctl状态mssql-server

We can see that SQL Service is in running (active) state and process id is assigned to the SQL Server service.

我们可以看到SQL服务处于运行(活动)状态,并且进程ID已分配给SQL Server服务。

As stated above, by default memory dump files are generated in the .log folder however it is for windows. In Linux, default path for the memory dump files are /var/opt/mssql/log.

如上所述,默认情况下,.log文件夹中会生成内存转储文件,但它适用于Windows。 在Linux中,内存转储文件的默认路径为/ var / opt / mssql / log。

Let us check the content of this path using the ls –lrt command.

让我们使用ls –lrt命令检查此路径的内容。

$ sudo su

$ sudo su

$ cd /var/opt/mssql/log

$ cd / var / opt / mssql / log

# ls –lrt

#ls –lrt

In the above screenshot, you can see there are multiple files for example trace files (*.trc), *.xel (extended event session files), SQL agent logs file (SQLagent.out), the error log file (error log). You cannot see any memory dump files currently because memory dumps are created in case of any exception or the system crash or the conditions specified above.

在上面的屏幕截图中,您可以看到有多个文件,例如跟踪文件(* .trc),*。xel(扩展事件会话文件),SQL代理日志文件(SQLagent.out),错误日志文件(错误日志) 。 当前看不到任何内存转储文件,因为在发生任何异常,系统崩溃或上述情况时会创建内存转储。

Now let us move back from the /var/opt/mssql/log folder using the exit command. This brings you back to $ prompt.

现在,让我们使用exit命令从/ var / opt / mssql / log文件夹移回。 这使您回到$提示符。

Let us create a directory in which we want to capture the memory dumps. You can create the directory using the mkdir command.

让我们创建一个要在其中捕获内存转储的目录。 您可以使用mkdir命令创建目录。

$ sudo mkdir /SQLDumps

$ sudo mkdir / SQLDumps

Currently, this directory will be empty. You can verify this as shown below.

当前,该目录为空。 您可以如下所示进行验证。

We also need to check the permissions for this directory. If we list out the directory and their permissions, we can see that ‘SQLDumps’ is having permissions for the root user.

我们还需要检查该目录的权限。 如果我们列出目录及其权限,则可以看到“ SQLDumps”具有root用户的权限。

In the next step, we need to change the owner and group of SQLDumps directory from root to mssql. This will enable SQL Server to access this particular directory.

下一步,我们需要将SQLDumps目录的所有者和组从根目录更改为mssql。 这将使SQL Server可以访问此特定目录。

Run the below commands

运行以下命令

$ sudo chown mssql SQLDumps

$ sudo chown mssql SQLDumps

$ sudo chgrp mssql SQLDumps

$ sudo chgrp mssql SQLDumps

Let me explain, briefly, about the chown and chgrp command here.

让我在这里简要介绍一下chown和chgrp命令。

Chown command: It modifies the user ownership of for the specified file or directory. Below is the syntax for the chown command.

Chown命令:修改指定文件或目录的用户所有权。 以下是chown命令的语法。

chown owner directory

chown所有者目录

Chgrp command: It changes the group ownership of a file or files. Below is the syntax for the chgrp command.

Chgrp命令:它更改一个或多个文件的组 所有权 。 以下是chgrp命令的语法。

Chgrp user directory

Chgrp用户目录

Once we have executed the chown and chgrp commands, let us verify the ownership of the SQLDumps folder again.

一旦执行了chown和chgrp命令,让我们再次验证SQLDumps文件夹的所有权。

In the above screenshot, we can see that the owner and group are changed to mssql.

在上面的屏幕截图中,我们可以看到所有者和组已更改为mssql。

Now we will change the default dump folder in the Linux using the mssql-conf utility. We can do the configuration of SQL Server running on Ubuntu, Linux, and SUSE Linux using this utility. The utility is installed in the /opt/mssql/bin directory. We can do below important configurations using this utility.

现在,我们将使用mssql-conf实用程序更改Linux中的默认转储文件夹。 我们可以使用此实用程序来配置在Ubuntu,Linux和SUSE Linux上运行SQL Server。 该实用程序安装在/ opt / mssql / bin目录中。 我们可以使用此实用工具在重要配置下面进行操作。

  • Enable SQL Server Agent 启用S​​QL Server代理
  • Change SQL Server collation 更改SQL Server排序规则
  • Set default mail profile 设置默认邮件配置文件
  • Set default data or log file directory 设置默认数据或日志文件目录
  • Set default dump directory 设置默认转储目录
  • Set default error log directory 设置默认错误日志目录
  • Set default backup directory 设置默认备份目录
  • Change default SQL Server Linux port 更改默认SQL Server Linux端口
  • Set Local audit directory 设置本地审核目录
  • Set memory configuration in SQL Server on Linux 在Linux上SQL Server中设置内存配置
  • Enable HA 启用高可用性
  • Configure TLS 配置TLS
  • Set trace flags 设置跟踪标志

To get the complete list of the configurations, go to the directory /opt/mssql/bin and run the command with list parameter as shown here.

要获取配置的完整列表,请转到目录/ opt / mssql / bin并运行带有list参数的命令,如下所示。

$ cd /opt/mssql/bin

$ cd / opt / mssql / bin

$sudo ./mssql-conf list

$ sudo ./mssql-conf列表

Below is the complete list of the configurations.

以下是配置的完整列表。

Run the below command in terminal to change the default dump directory to SQLDumps directory.

在终端中运行以下命令,将默认转储目录更改为SQLDumps目录。

$ sudo /opt/mssql/bin/mssql-conf set filelocation.defaultdumpdir /SQLDumps

$ sudo / opt / mssql / bin / mssql-conf设置文件位置。defaultdumpdir / SQLDumps

We need to restart the SQL Server to make this change effective. Run the below command to restart the SQL Server.

我们需要重新启动SQL Server才能使此更改生效。 运行以下命令以重新启动SQL Server。

Command:

命令:

Sudo systemctl restart mssql-server

Sudo systemctl重新启动mssql-server

Verify the status of SQL Server service again and make sure it is in running status.

再次验证SQL Server服务的状态,并确保它处于运行状态。

翻译自: https://www.sqlshack.com/changing-sql-dump-file-locations-in-sql-server-on-linux/

转储sql文件

转储sql文件_在Linux上SQL Server中更改SQL转储文件位置相关推荐

  1. sql数据库备份默认路径_在Linux上SQL Server中更改默认数据库文件和备份路径

    sql数据库备份默认路径 In a previous article, we explored the process to change default SQL dump file location ...

  2. linux中jdk添加字体_在Linux上为Openjdk Java定义/安装字体的位置

    在Ubuntu上安装了Oracle 8 jdk,在jre/lib中它具有各种fontProperties文件和一个包含字体的字体目录.但是,当安装OpenJdk 8时,jre/lib中的字体文件上没有 ...

  3. linux 解压所有以zip结尾的文件_在 Linux 上压缩文件:zip 命令的各种变体及用法...

    除了压缩和解压缩文件外,你还可以使用 zip 命令执行许多有趣的操作.这是一些其他的 zip 选项以及它们如何提供帮助. -- Sandra Henry-stocker(作者) 为了节省一些磁盘空间并 ...

  4. linux下mkdir头文件_整理Linux下gcc编译中关于头文件与库文件搜索路径相关问题

    态库./libpos.so. /root/test/env/lib/libpos.so和/root/test/conf/lib/libpos.so.我们再用源程序 pos_lib.c(见程序5)来创建 ...

  5. mysql 开启守护进程_[求助]Linux上MySQL Server 5.6 安装后无法启动守护进程

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 1 所谓的初始化数据库脚本运行错误 /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/lo ...

  6. .axf文件_干货!STM32晶振的更改,BIN文件的生成

    STM32因为硬件设计的不同,要根据实际安装晶振修改程序参数, 一般使用的晶振是8M,如果遇到使用24M晶振的时候程序配置要怎么去修改呢? 一共有两处需要修改,如果是24M就把这个修改为24,同理8M ...

  7. sql server重命名_在Linux上SQL Server中重命名逻辑和物理文件名

    sql server重命名 Each database in SQL Server contains at least two files i.e. Data file (*.mdf) and log ...

  8. 如何在Linux上找到包含特定文本的所有文件?

    我正在尝试找到一种方法来扫描整个Linux系统,查找包含特定文本字符串的所有文件. 只是为了澄清,我在文件中寻找文本,而不是文件名. 当我查找如何做到这一点时,我遇到了两次这个解决方案: find / ...

  9. linux系统读取excel文件是否存在,小弟我用poi读excel,在window下没有有关问题,但把程序放到linux上时,读取客户端的excel文件报错,不...

    我用poi读excel,在window下没有问题,但把程序放到linux上时,读取客户端的excel文件报错,不知道如何解决 我用poi读excel,在window下没有问题,但把程序放到linux上 ...

最新文章

  1. atlas单机模式代码_用代码玩太无聊,这样玩海盗游戏《ATLAS》单机模式才是正确玩法...
  2. 复习计算机网络基础 day7--网络层
  3. pycharm 调试(debug)模式时界面上的 mute breakpoint 是什么意思?(239)
  4. mysql 异常关机后 无法查数据_MySQL数据库非法关机造成数据表损坏怎么排查 | 学步园...
  5. MySQL和mq一致性,Mysql与Redis一致性问题
  6. leetcode349. 两个数组的交集
  7. 《Redis官方文档》Data types—数据类型
  8. WCF中如何用nettcp协议进行通讯
  9. visual basic开发实例大全(基础卷_2021中考数学、物理、化学公式大全!建议收藏!...
  10. 第一篇:webservice初探
  11. 系统运行后修改linux系统时区
  12. Android 开发问题
  13. 机器学习实战(十一)FP-growth算法
  14. SPSS的下载和使用经历
  15. 【js+html禁用截屏,打印,另存为】
  16. jbX和finss的一些问题
  17. 【pano2vr】网页Flash中简单实现炫酷的3D模型制作
  18. Matlab龚珀兹曲线模型预测,统计预测方法及预测模型介绍.ppt
  19. 计算机毕业设计(附源码)python租车信息管理系统
  20. 法国为何是伟大数学家的摇篮?

热门文章

  1. pom.xml文件引入tools.jar
  2. BZOJ1853: [Scoi2010]幸运数字(容斥原理)
  3. BUPT复试专题—统计字母(2008)
  4. Jenkins:项目配置
  5. python初心记录一
  6. sublimeText3安装emmet(For Mac)
  7. AJAX JSONP源码实现(原理解析)
  8. 13.无名管道通讯编程
  9. SQL Server 2005导入导出存储过程
  10. ★LeetCode(196)——删除重复的电子邮箱(MySQL)