Zabbix告警:SQL Instance MSSQLSERVER: Could not allocate a new page
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Zabbix告警:SQL Instance MSSQLSERVER: Could not allocate a new page相关的知识,希望对你有一定的参考价值。
Zabbix的监控出现告警,具体的告警信息如下:“SQL Instance MSSQLSERVER: Could not allocate a new page”和“D::Disk space is low(used > 80%)"
第一个告警是Zabbix template for Microsoft SQL Server模板发出的告警,查看其具体信息,可以看到如下具体信息:
Msg 1101 or 1105 was logged in the Windows Application Event Log. These errors indicate that SQL server could not allocate a new page for database because of insufficient disk space in filegroup. Create the necessary space by dropping objects in the filegroup, adding additional files to the filegroup, or setting Autogrowth on for existing files in the filegroup.
简单一点说,就是因为服务器由于磁盘空间不足或数据库文件限制了最大大小,导致SQL Server无法为数据库分配新的页面,请检查磁盘空间是否足够或给数据库文件设置自动增长。
但是其不能明确的提示是那个数据库出现问题,虽然结合磁盘空间告警,我们已经能够猜测是tempdb出现了问题,另外,SQL Server Alert也发出了告警邮件,具体信息如下,这个告警就能明确是那个数据库出现问题了:
DATE/TIME: 2020/11/11 9:35:34
DESCRIPTION: Could not allocate space for object \'<temporary system object: 1225067284549599232>\' in database \'tempdb\' because the \'PRIMARY\' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.
其实综合上面信息,就是因为一些问题SQL,在短时间内消耗了数据库tempdb大量的空间,导致tempdb数据库大小短时间内迅猛增长,我们这台服务器的tempdb数据库(单独放置在D盘),虽然设置了自动增长,但是我们设置了tempdb单个数据文件的MaxSize为10GB, 其总大小为80GB,但是这个仍然不能满足问题SQL的需求,不能分配新的页面,所以出现了上面告警。
USE [tempdb]
GO
SELECT @@SERVERNAME AS [ServerName]
,[name] AS [LogicalName]
,[type_desc] AS [TypeDesc]
,[physical_name] AS [PhysicalName]
,CONVERT(NUMERIC(10,2),ROUND([size]/128.,2)) AS [Size(MB)]
,CONVERT(NUMERIC(10,2),ROUND(FILEPROPERTY([name],\'SpaceUsed\')/128.,2)) AS [Used(MB)]
,CONVERT(NUMERIC(10,2),ROUND(([size]-FILEPROPERTY([name],\'SpaceUsed\'))/128.,2)) AS [Unused(MB)]
,CASE WHEN is_percent_growth = 1
THEN RTRIM(CAST(Growth AS CHAR(10))) + \'%\'
ELSE RTRIM(CAST(Growth*8.0/1024 AS CHAR(18))) + \'M\'
END AS [Growth(MB)]
,CASE WHEN max_size = -1 THEN \'Unlimit\'
ELSE CAST(CAST(max_size * CONVERT(FLOAT, 8)/1024/1024 AS NUMERIC(10,2)) AS VARCHAR(32))
END AS [MaxSize(GB)]
,is_media_read_only AS [IsReadOnlyMedia]
,is_read_only AS [IsReadOnly]
,CAST(CASE state
WHEN 6 THEN 1
ELSE 0
END AS BIT) AS [IsOffline]
,is_sparse AS [IsSparse]
FROM [sys].[database_files]
ORDER BY name;
另外,我们通过zabbix监控的磁盘D的空间消耗情况如下。可以看到其在短时间内被消耗殆尽。
虽然Zabbix比较擅长监控,但是它无法定位问题SQL,这个需要通过作业或扩展事件监控来捕获问题SQL语句。这篇不打算展开介绍,后面单独一篇讲述如何捕获这些问题SQL语句!
以上是关于Zabbix告警:SQL Instance MSSQLSERVER: Could not allocate a new page的主要内容,如果未能解决你的问题,请参考以下文章