The mechanism for grooming the operational database in SCOM has changed compared to MOM 2005. In MOM 2005 we had a SQL job to handle the grooming – in SCOM 2007 we have a SCOM rule. The rule has a set schedule to run daily at midnight – and there is no built in override to allow this schedule to be changed. In some situations, it's helpful to manually force grooming. This can be done by manually executing the p_partitioningandgrooming stored procedure. This will call a series of other procedures which will grab your groom settings (retention threshold values) from the database and proceed with the groom.
The mechanism for grooming the datawarehouse is a bit more involved. First, there is no way to set the data retention period for the warehouse in the UI. These retention periods are stored in the MaxDataAgeDays column in the StandardDatasetAggregation table of the warehouse. You can set these however you like. From there, grooming (and aggregation actually) happens every time data is inserted into the warehouse. To be sure though, you can also trigger it to happen manually by running the following stored procedure from the data warehouse.
Exec standarddatasetgroom <datasetid>
The dataset ID’s represent the type of data to be acted on. You can grab the datasetid from the dataset table which is also in the datawarehouse. If you open this table you will note there are 5 dataset types – event, client monitoring, performance, alert and state.
When SCOM actually does the aggregation and groom job it calls the standarddatasetmaintenance stored proc which will result in the standarddatasetgroom procedure getting called. For grooming, we don’t care about aggregation so we can just call the groom job directly.