剩餘的 DB 記錄檔可用空間

Microsoft.SQLServer.Linux.Monitor.DBLogFile.DBLogFileSpace (UnitMonitor)

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

Knowledge Base article:

摘要

此監視器會監視記錄檔與記錄檔裝載媒體上的可用空間。必須為至少一個檔案啟用自動成長,才會將媒體上的可用空間視為可用空間的一部分。

原因

所有記錄檔的可用空間皆不足而導致健全狀況不佳的狀態。造成可用空間不足的可能原因為:

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

此監視器會依據每個檔案的組態彙總資料庫內每個記錄檔的可用空間:

不自動成長

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

自動成長已啟用

除了檔案大小與已用空間兩者間的差異之外,啟用自動成長之檔案的可用空間大小,將會在大小上限與檔案大小之間的差異,以及磁碟上剩餘的可用空間這兩者中取較小者。

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

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

解決方式

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

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

可覆寫的參數

名稱

描述

預設值

警示優先順序

定義警示優先順序。

標準

警示嚴重性

定義警示嚴重性。

錯誤

Azure 檔案大小上限 (MB)

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

1048576

重大臨界值

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

10

已啟用

啟用或停用該工作流程。

產生警示

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

間隔 (秒)

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

900

同步處理時間

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

 

逾時 (秒)

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

300

資料庫連線的逾時 (秒)

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

15

警告閾值

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

20

Element properties:

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

Source Code:

<UnitMonitor ID="Microsoft.SQLServer.Linux.Monitor.DBLogFile.DBLogFileSpace" Accessibility="Public" Enabled="true" Target="SqlDiscL!Microsoft.SQLServer.Linux.DBLogFile" ParentMonitorID="Health!System.Health.PerformanceState" Remotable="true" Priority="Normal" TypeID="Microsoft.SQLServer.Linux.MonitorType.DBLogFile.DBLogFileSpace" ConfirmDelivery="true">
<Category>PerformanceHealth</Category>
<AlertSettings AlertMessage="Microsoft.SQLServer.Linux.Monitor.DBLogFile.DBLogFileSpace.AlertMessage">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>MatchMonitorHealth</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Target/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/MachineName$</AlertParameter1>
<AlertParameter2>$Target/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.Database"]/DatabaseName$</AlertParameter4>
<AlertParameter5>$Data/Context/Property[@Name='FreeSpaceMB']$</AlertParameter5>
<AlertParameter6>$Data/Context/Property[@Name='FreeSpacePercent']$</AlertParameter6>
</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/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/MachineName$</MachineName>
<NetbiosComputerName>$Target/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/NetbiosComputerName$</NetbiosComputerName>
<InstanceName>$Target/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/InstanceName$</InstanceName>
<DatabaseName>$Target/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>FreeSpacePercent</ValuePropertyName>
<Threshold1>10</Threshold1>
<Threshold2>20</Threshold2>
<ConnectionString>$Target/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/ConnectionString$</ConnectionString>
<InstanceVersion>$Target/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/Version$</InstanceVersion>
<InstanceEdition>$Target/Host/Host/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/Edition$</InstanceEdition>
<SqlTimeoutSeconds>15</SqlTimeoutSeconds>
<TimeoutSeconds>300</TimeoutSeconds>
<IntervalSeconds>900</IntervalSeconds>
<SyncTime/>
</Configuration>
</UnitMonitor>