Scheduling the automatic data cleanup


You can configure the Maintenance Server to schedule automatic data cleanup. These cleanup runs replace the scheduled NSH jobs that have previously been used to run cleanups. The Maintenance Server manages the cleanup activities, such as:

  • Start and stop the scheduled cleanup task
  • Add cleanup modules to a queue and run them sequentially

You can schedule daily and weekly cleanup jobs. Daily cleanup runs the following jobs:

  • Cleanup JobRunEvent
  • Cleanup AuditTrail
  • Cleanup JobSchedule
  • Cleanup AuditResult
  • Cleanup ComplianceResult 
  • Cleanup PatchResult
  • Cleanup Deploy
  • Cleanup SharedData
  • Cleanup SnapshotResult (Snapshot cleanup requires some additional considerations. For details, see Cleanup-considerations-for-snapshot.)
  • Cleanup OldVersionComponent
  • Cleanup OldVersionJob
  • Cleanup ListBLValue

Weekly cleanup runs the following jobs:

  • Cleanup Retention
  • Cleanup Database
  • Cleanup Shared Objects
  • Cleanup FileServer

For information about the distinction between these cleanup types, see Example-cleanup-plan-for-large-operational-environments.

Setting up automatic data cleanup

To configure the Maintenance Server to enable automatic cleanup, create a cleanup schedule and define a cleanup frequency using the blasadmin commands. 

Important

When a scheduled auto cleanup job is running, make sure that the jobs that are scheduled using the NSH scripts are not running. For information about scheduling jobs using the NSH scripts, see Scheduling-the-script-based-cleanup-job.

Do the following:

  1. Log in to the  console.
  2. Deploy the Maintenance Server if it is not already deployed in your environment. For details, see Deploying-a-Maintenance-Server
  3. Right-click the Maintenance Server, and click Start.
  4. Run the following blasadmin command to change to the newly created Maintenance Server.
    switch <server_name>
    For example, switch MaintenanceServer
  5. Run the following blasadmin command to enable auto cleanup. By default, auto cleanup is disabled.
    set Maintenance EnableAutoCleanup True
  6. Run the following command to set the start time of the auto cleanup job as the current time of the Application Server:
    set Maintenance AutoCleanupDailyStartTime 
    For example, set Maintenance AutoCleanupDailyStartTime 20:00
  7. (optional) Run the following blasadmin commands to customize the parameters for the daily cleanup:

    Command

    Description

    AutoCleanupJobsCountThreshold

    Threshold of number of running jobs during the time window before the auto cleanup runs a task. The default is 50 running jobs. If the number of running jobs exceed this threshold, the auto cleanup task is not triggered.

    AutoCleanupDailyStartTime

    The time (in the hh:mm format) when the auto cleanup runs. The default is 00:00.

    AutoCleanupDailyWindowInHours

    The number of running hours for the auto cleanup. The default is four hours.

    AutoCleanupDaysOfTheWeekToRun

    The days of the week (in the comma separated format) when you want to run the auto cleanup. Specify only the first two letters of a day. For example, to run auto cleanup on Monday, Tuesday, and Thursday, specify Mo, Tu, Th
    The default setting is blank, which indicates that the auto cleanup runs on all days.

    AutoCleanupRunIntervalInMinutes

    The interval (in minutes) at which the running of daily auto cleanup is checked. The default interval is 15 minutes.

    AutoCleanupMaxDurationPerCleanupCallInMinutes

    The maximum duration (in minutes) to be spend for an individual call to the cleanup service. The default is 30 minutes.

    AutoCleanupStatusReportRecipients

    A semi-colon separated list of email addresses that are notified about the status of the auto cleanup task.

    AutoCleanupStatusReportFrequency

    The frequency (in hours) at which the status report emails are sent. The default is 24 hours. 

    AutoCleanupJobRunEventRetention

    The retention time (in days) for the Job Run Event cleanup task. The default is 30 days.

    AutoCleanupJobScheduleRetention

    The retention time (in days) for the Job Schedule cleanup task. The default is 30 days.

    AutoCleanupAuditTrailRetention

    The retention time (in days) for the Audit Trail cleanup task. The default is 30 days.

    AutoCleanupEnableUpdateGlobalIndex

    A Boolean value that indicates whether you want to enable the creation of global indexes for the table partitions that are marked as orphan entries. By default, the creation of global indexes is enabled for Oracle environments.
    Note: If you do not want to use table partitioning, change this command value to false before starting the auto cleanup task. Otherwise, the Maintenance Server logs display the following error:"No cleanup procedure by name: UpdateGlobalIndex
    com.bladelogic.om.infra.mfw.util.BlException: No cleanup procedure by name: UpdateGlobalIndex"

  8. (optional) Run the following blassadmin commands to enable and schedule the weekly data cleanup:

    Command

    Description

    AutoCleanupEnableWeeklyTask

    A Boolean value that indicates whether the weekly cleanup is enabled. By default, it is disabled.

    AutoCleanupWeeklyTaskCleanupDatabaseDuration

    The duration (in hours) for the weekly cleanup task. The default is eight hours.

    AutoCleanupWeeklyTaskDaysOfTheWeek

    A day within a week when you want to run the weekly cleanup. Specify only the first two letters of a day. For example, to run the cleanup on Monday, specify Mo.
    By default, the weekly cleanup is scheduled to run every Sunday at 00:00 hours.

    AutoCleanupWeeklyTaskExecRetentionPolicy
    Duration

    The duration (in hours) for the execution retention policy. The default is one hour.

    AutoCleanupWeeklyTaskHardDeleteSharedObjects
    Duration

    The duration (in hours) to hard delete all the shared objects. The default is two hours.

    AutoCleanupWeeklyTaskStartTime

    The time when you want to start the weekly cleanup. The default is 00:00 hours.

  9. Restart the Maintenance Server.

Important

Make sure that your daily and weekly job runs do not overlap. For example, you schedule a weekly job to be run every Saturday at 8.00 using the following blasadmin settings:

  • AutoCleanupWeeklyTaskDaysOfTheWeek
  • AutoCleanupWeeklyTaskStartTime

Make sure that your daily job is either completed running or is not running at the same time. To do so, configure the following blasadmin settings for the daily job runs accordingly:

  • AutoCleanupDaysOfTheWeekToRun
  • AutoCleanupDailyStartTime
  • AutoCleanupDailyWindowInHours

After configuring the Maintenance Server, the auto cleanup is skipped during the following scenarios:

Scenario

Result

The EnableAutoCleanup setting is set to false or not yet set (the default setting is false).

Auto cleanup is skipped and the Maintenance Server log shows the following message:
Daily Auto Cleanup operation <operation_name> skipped due to auto cleanup thread being disabled.

The auto cleanup is scheduled to run at 00:00 hours for 4 hours.

Auto cleanup is skipped and the Maintenance Server log shows the following message:
Daily Auto Cleanup operation <operation_name> skipped due to not being in a scheduled window.

Jobs are already scheduled to run in the future, such as 50 jobs scheduled to run within the next 2 hours.

Auto cleanup is skipped and the Maintenance Server log shows the following message:

Daily Auto Cleanup operation <operation_name> skipped due to future job load.

The current database utilization exceeds 80% of the maximum utilization. (Database load is checked for number of processes or transactions or sessions in the V$RESOURCE_LIMIT view against maximum utilization.)

Auto cleanup is skipped and the Maintenance Server log shows the following message:

Daily Auto Cleanup operation <operation_name> skipped due to current database load. 

Troubleshooting

If you observe any issues during cleanup, check the cleanup logs that are available at this path to troubleshoot the issues: installDirectory/br
For example:

  • (Windows) C:\Program Files\BMC Software\BladeLogic\appserver\NSH\br\<MaintenanceServer.log>
  • (Linux) /opt/bmc/bladelogic/NSH/br/<MaintenanceServer.log>

The log file name is the name of the Maintenance Server deployment instance.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*