資料庫空間百分比變更

Microsoft.SQLServer.2016.Database.DBSizePercentageChangeMonitor (UnitMonitor)

監視資料庫的可用空間數,在經過一些取樣期間後有無重大變化。注意: 預設會停用此監視器。必要時請使用覆寫加以啟用。

Knowledge Base article:

摘要

監視資料庫可用空間的值,在經過設定的取樣期間後有無重大變化。值急遽變化時,可能表示已發生問題。

原因

可用空間在經過設定的取樣期間次數後,發生重大變化而導致健全狀況不佳的狀態。造成這種情況的可能原因為:

請使用下列連結來檢視效能資料: 資料庫效能資料

此監視器會依據每個檔案的組態,彙總檔案群組內每個檔案的可用空間:

無自動成長

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

啟用自動成長

除了檔案大小與已使用空間兩者間的差值之外,啟用自動成長的檔案,其可用空間將會是大小上限與檔案大小的差值加上磁碟上剩餘的可用空間 (取兩者的最小值)。

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

解決方式

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

可覆寫的參數

名稱

描述

預設值

警示優先程式

定義警示優先順序。

一般

警示嚴重性

定義警示嚴重性。

MatchMonitorHealth

Azure 檔案大小上限 (MB)

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

1048576

重大臨界值

若此值超過這個臨界值,此監視器會將狀態變更為重大。若在這個臨界值與警告臨界值 (含) 之間,此監視器會是警告狀態。

45

已啟用

啟用或停用該工作流程。

產生警示

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

間隔 (秒)

執行工作流程的週期性時間間隔 (秒)。

900

範例數

指出測量值在違反臨界值多少次之後,才會變更狀態。

5

同步處理時間

使用 24 小時制指定的同步處理時間。將會忽略。

 

逾時 (秒)

指定允許工作流程在關閉且標示為失敗之前執行的時間。

300

警告臨界值

警告臨界值。超出此臨界值會導致監視器變更為至少是警告狀態。

25

Element properties:

TargetMicrosoft.SQLServer.2016.Database
Parent MonitorMicrosoft.SQLServer.2016.Database.DBSpaceMonitor
CategoryPerformanceHealth
EnabledFalse
Alert GenerateTrue
Alert SeverityMatchMonitorHealth
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.SQLServer.2016.DBPercentageChange
RemotableTrue
AccessibilityPublic
Alert Message
MSSQL 2016: 資料庫可用空間總計中的重大百分比變更
電腦 {0} 上 SQL 執行個體 {1} 中資料庫 {2} 的可用空間出現重大變更。如需詳細資料,請參閱 [警示內容] 索引標籤。
RunAsDefault

Source Code:

<UnitMonitor ID="Microsoft.SQLServer.2016.Database.DBSizePercentageChangeMonitor" Accessibility="Public" Enabled="false" Target="SQL2016Core!Microsoft.SQLServer.2016.Database" ParentMonitorID="Microsoft.SQLServer.2016.Database.DBSpaceMonitor" Remotable="true" Priority="Normal" TypeID="Microsoft.SQLServer.2016.DBPercentageChange" ConfirmDelivery="false">
<Category>PerformanceHealth</Category>
<AlertSettings AlertMessage="Microsoft.SQLServer.2016.Database.DBSizePercentageChangeMonitor.AlertMessage">
<AlertOnState>Warning</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>MatchMonitorHealth</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Target/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</AlertParameter1>
<AlertParameter2>$Target/Host/Property[Type="SQL2016Core!Microsoft.SQLServer.2016.ServerRole"]/InstanceName$</AlertParameter2>
<AlertParameter3>$Target/Property[Type="SQL2016Core!Microsoft.SQLServer.2016.Database"]/DatabaseName$</AlertParameter3>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="UnderThreshold1" MonitorTypeStateID="UnderThreshold1" HealthState="Success"/>
<OperationalState ID="OverThreshold1UnderThreshold2" MonitorTypeStateID="OverThreshold1UnderThreshold2" HealthState="Warning"/>
<OperationalState ID="OverThreshold2" MonitorTypeStateID="OverThreshold2" HealthState="Error"/>
</OperationalStates>
<Configuration>
<IntervalSeconds>900</IntervalSeconds>
<SyncTime/>
<ConnectionString>$Target/Host/Property[Type="SQL2016Core!Microsoft.SQLServer.2016.DBEngine"]/ConnectionString$</ConnectionString>
<ServerName>$Target/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ServerName>
<SqlInstanceName>$Target/Host/Property[Type="SQL2016Core!Microsoft.SQLServer.2016.ServerRole"]/InstanceName$</SqlInstanceName>
<ObjectName>SQL Database</ObjectName>
<CounterName>DB Available Space Total (%)</CounterName>
<InstanceName/>
<DatabaseName>$Target/Property[Type="SQL2016Core!Microsoft.SQLServer.2016.Database"]/DatabaseName$</DatabaseName>
<Value>$Data/Property[@Name='DBFreeSpacePercent']$</Value>
<Threshold1>25</Threshold1>
<Threshold2>45</Threshold2>
<NumSamples>5</NumSamples>
<TimeoutSeconds>300</TimeoutSeconds>
<AzureMaxFileSizeMB>1048576</AzureMaxFileSizeMB>
</Configuration>
</UnitMonitor>