SCOM操作管理数据库的数据整理和报表的数据仓库的数据整理设置是不同的。
操作管理数据库的数据整理设置如下:
管理-全局数据库设置-数据库整理(database grooming)中,选择一个数据类型进行编辑就可以了。默认是保留7天的数据。具体可以参考如下:
数据仓库的整理设置没有图形界面提供,设置信息保存在StandardDatasetAggregation表中,你可以使用如下的SQL查询语句检查默认的保存时间:

Code
SELECT AggregationIntervalDurationMinutes, BuildAggregationStoredProcedureName, GroomStoredProcedureName, MaxDataAgeDays, GroomingIntervalMinutes, MaxRowsToGroom FROM StandardDatasetAggregation
默认查询结果如下:
AggregationInterval DurationMinutes |
BuildAggregation StoredProcedureName |
GroomStored ProcedureName |
MaxData AgeDays |
Grooming IntervalMinutes |
MaxRows ToGroom |
| NULL |
NULL |
EventGroom |
100 |
240 |
100000 |
| NULL |
NULL |
AlertGroom |
400 |
240 |
50000 |
| NULL |
NULL |
StateGroom |
180 |
60 |
50000 |
| 60 |
StateAggregate |
StateGroom |
400 |
60 |
50000 |
| 1440 |
StateAggregate |
StateGroom |
400 |
60 |
50000 |
| NULL |
AemAggregate |
AemGroom |
30 |
240 |
100000 |
| 1440 |
AemAggregate |
AemGroom |
400 |
240 |
100000 |
| NULL |
PerformanceAggregate |
Performance Groom |
10 |
240 |
100000 |
| 60 |
PerformanceAggregate |
Performance Groom |
400 |
240 |
100000 |
| 1440 |
PerformanceAggregate |
Performance Groom |
400 |
240 |
100000 |
注意:
- AggregationIntervalDurationMinutes是数据聚合的间隔时间,NULL是原始数据(没有聚合),60是一小时,1440是一点
- MaxDataAgeDays是数据保存的最大天数,取决于数据类型和聚合程度,默认是10天到400天
- GroomingIntervalMinutes是数据整理的频率,Performance, Alert, Event, 和AEM数据每隔240分钟(4小时)整理一次,State数据每隔1小时整理一次。
另外,不同的数据根据聚合类型的不同,其保留的时间是不同的,比如性能原始数据,和性能每日聚合数据保留的时间就不同。这些设置也保存在StandardDatasetAggregation表中。
StandardDatasetAggregation表的主键是一个组合键值,由DatasetID和AggregationTypeID两个构成。
DatasetID来源于Dataset表,该表记录了SCOM中的标准数据集,导入MP也会带来新的数据集定义;AggregationTypeID来源于AggregationType表,该表记录了聚合类型的默认名称和GUID等信息。
AggregationTypeID有如下的值:
0 =原始数据
10=不足一小时
20=每小时
30=每天
因此我们先在Dataset表中找到要更改整理设置的数据集名称,然后在DatasetID列中记下它的GUID,接着打开StandardDatasetAggregation表,根据记下的GUID,再结合AggregationTypeID确定聚合类型,修改MaxDataAgeDays列的值。
具体步骤可以参考:
另外,SCOM SP1后,微软推出了一个工具wdatarp.exe,可以查看数据仓库中的数据保留策略,这个工具的使用方法可以参考:
本文参考了: