剩餘的 DB 檔案可用空間

Microsoft.SQLServer.Linux.Monitor.DBFile.DBFileSpace (UnitMonitor)

可用空間 (包含媒體上已配置的空間與可用空間) 低於警告臨界值設定 (以資料大小與磁碟可用空間總和的百分比表示) 時,此監視器會回報警告。當可用空間低於重大臨界值時,此監視器會在回報重大警示。

Knowledge Base article:

摘要

此監視器會監看檔案中以及裝載檔案之媒體上的可用空間。只有在指定的檔案啟用自動成長時,才會考慮媒體上的可用空間。

原因

這個檔案的可用空間不足導致健全狀況不佳的狀態。造成可用空間不足的可能原因為:

請使用下列連結檢視效能資料: DB 檔案可用空間效能資料

不自動成長

若是沒有自動成長的檔案,可用空間將會是檔案初始大小與已使用空間之間的差值。

自動成長已啟用

啟用自動成長時,可用磁碟空間會納入可用空間。除了檔案大小與已使用空間之間的差值之外,啟用自動成長之檔案的可用空間將會是大小上限與檔案大小之間差值以及磁碟上剩餘的可用空間這兩者中的最小值。

有自動成長功能的資料庫檔案之可用空間不足,可能表示該檔案已接近裝載邏輯磁碟機的限制。對於已啟用自動成長且設有大小上限的檔案而言,可用空間不足也可能表示檔案已接近為檔案所指定的大小上限。

可用空間的計算也會考量到如果檔案成長幅度大於磁碟上剩餘的可用空間,或大小上限與目前檔案大小之間的差值小於成長幅度,檔案在這些情況下也會無法成長。在上述這些情況中,磁碟上剩餘的可用空間將不會納入可用空間,因為已無法再繼續成長了。

解決方式

您可以使用以下任一方法來解決此問題:

請參閱《SQL Server 線上叢書》: 檔案與檔案群組架構

可覆寫的參數

名稱

描述

預設值

警示優先順序

定義警示優先順序。

標準

警示嚴重性

定義警示嚴重性。

錯誤

Azure 檔案大小上限 (MB)

Azure BLOB 儲存體中所儲存的資料檔案大小上限。此工作流程會考慮將此值用作每個檔案的儲存體容量上限。

1048576

重大臨界值

如果值低於此臨界值,此監視器會將其狀態變更為 [重大]。在此臨界值與警告臨界值 (含) 之間的值,會讓監視器處於警告狀態。

10

已啟用

啟用或停用該工作流程。

產生警示

定義工作流程是否要產生警示。

間隔 (秒)

每次重複執行工作流程之間的時間間隔 (秒)。

900

同步處理時間

同步處理時間使用 24 小時制。可予省略。

 

逾時 (秒)

指定流程被關閉及標示為失敗之前,允許執行的時間。

300

資料庫連線的逾時 (秒)

若工作流程無法在指定的期限之內存取資料庫,將會失敗並登錄一則事件。

15

警告閾值

如果值低於此臨界值,此監視器會將其狀態變更為 [警告]。

20

Element properties:

TargetMicrosoft.SQLServer.Linux.DBFile
Parent MonitorSystem.Health.PerformanceState
CategoryPerformanceHealth
EnabledTrue
Alert GenerateTrue
Alert SeverityMatchMonitorHealth
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.SQLServer.Linux.MonitorType.DBFile.DBFileSpace
RemotableTrue
AccessibilityPublic
Alert Message
Linux 上的 MSSQL: 資料庫檔案的空間即將用盡
電腦 "{4}" 上 SQL 執行個體 "{3}" 中資料庫 "{2}" 內檔案群組 "{1}" 的 DB 檔案 "{0}",即將用盡空間。如需詳細資料,請參閱知識一節。
RunAsDefault

Source Code:

<UnitMonitor ID="Microsoft.SQLServer.Linux.Monitor.DBFile.DBFileSpace" Accessibility="Public" Enabled="true" Target="SqlDiscL!Microsoft.SQLServer.Linux.DBFile" ParentMonitorID="Health!System.Health.PerformanceState" Remotable="true" Priority="Normal" TypeID="Microsoft.SQLServer.Linux.MonitorType.DBFile.DBFileSpace" ConfirmDelivery="true">
<Category>PerformanceHealth</Category>
<AlertSettings AlertMessage="Microsoft.SQLServer.Linux.Monitor.DBFile.DBFileSpace.AlertMessage">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>MatchMonitorHealth</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Target/Host/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/MachineName$</AlertParameter1>
<AlertParameter2>$Target/Host/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/InstanceName$</AlertParameter2>
<AlertParameter3>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.File"]/FileName$</AlertParameter3>
<AlertParameter4>$Target/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.Filegroup"]/GroupName$</AlertParameter4>
<AlertParameter5>$Target/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.Database"]/DatabaseName$</AlertParameter5>
<AlertParameter6>$Data/Context/Property[@Name='FreeSpaceMB']$</AlertParameter6>
<AlertParameter7>$Data/Context/Property[@Name='FreeSpacePercent']$</AlertParameter7>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="UnderThreshold1" MonitorTypeStateID="UnderThreshold1" HealthState="Error"/>
<OperationalState ID="OverThreshold1UnderThreshold2" MonitorTypeStateID="OverThreshold1UnderThreshold2" HealthState="Warning"/>
<OperationalState ID="OverThreshold2" MonitorTypeStateID="OverThreshold2" HealthState="Success"/>
</OperationalStates>
<Configuration>
<MachineName>$Target/Host/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/MachineName$</MachineName>
<NetbiosComputerName>$Target/Host/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/NetbiosComputerName$</NetbiosComputerName>
<InstanceName>$Target/Host/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/InstanceName$</InstanceName>
<DatabaseName>$Target/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.Database"]/DatabaseName$</DatabaseName>
<FileName>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.File"]/FileName$</FileName>
<AzureMaxFileSizeMB>1048576</AzureMaxFileSizeMB>
<ValuePropertyName>FreeSpacePercentMon</ValuePropertyName>
<Threshold1>10</Threshold1>
<Threshold2>20</Threshold2>
<ConnectionString>$Target/Host/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/ConnectionString$</ConnectionString>
<InstanceVersion>$Target/Host/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/Version$</InstanceVersion>
<InstanceEdition>$Target/Host/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/Edition$</InstanceEdition>
<SqlExecTimeoutSeconds>60</SqlExecTimeoutSeconds>
<SqlTimeoutSeconds>15</SqlTimeoutSeconds>
<TimeoutSeconds>300</TimeoutSeconds>
<IntervalSeconds>900</IntervalSeconds>
<SyncTime/>
</Configuration>
</UnitMonitor>