Page tree
Skip to end of metadata
Go to start of metadata

The executeRetentionPolicy command used by the cleanup script runs a retention policy utility that allows you to mark objects for deletion from the BMC Server Automation database. These objects include old job runs and job and depot objects automatically created during patching and auto-remediation. After they are marked for deletion, the objects are deleted from the database the next time that a database cleanup is performed. (In addition, files associated with the objects are deleted from the File Server the next time that a file server cleanup is performed.) Using the retention policy utility in this way lets you manage the amount of physical space the database requires and avoid potential performance issues resulting from your database getting too large.

By default, the retention policy utility is not enabled to avoid the possibility of deleting data unknowingly. By enabling the utility and setting the retention period, the objects that are candidates for deletion (because they are older than the specified retention period) are marked for deletion when the retention policy is executed.

The following sections summarizes the steps for marking job runs for deletion:

To enable or disable the retention policy utility

The following procedure lets you enable or disable the retention policy.

  1. Start the Application Server Administration console, as described in Starting the Application Server Administration console.
  2. To enable or disable the retention policy utility, enter the following:
    set Cleanup EnableRetentionPolicy true|false
    where:
    true — Enables the retention policy utility, which lets you mark objects for deletion from the BMC Server Automation database. (Objects are deleted from the database the next time the database cleanup utility is run. In addition, files associated with the objects are deleted from the file server the next time the file server cleanup utility is run.)
    false — Disables the retention policy utility. You cannot mark objects for deletion during database cleanup.
  3. Restart the Application Server to have this change take effect.

To set the retention period for job runs

You can set the number of days to retain job runs before marking them for deletion. BMC typically recommends a value of 30 days for this retention time. If the number of days is not set, the default value is 0, and job runs are not deleted.
To set the number of days to retain job runs before marking them for deletion, do any of the following:

  • To set the default retention period for all jobs, set the RESULTS_RETENTION_TIME property for the Job property class in the Property Dictionary. For details on setting a property using the Property Dictionary, see Adding or modifying properties.
  • To set the default retention period for all jobs of a specific type, set the RESULTS_RETENTION_TIME property for the specific job property class in the Property Dictionary (for example, the SnapshotJob property class). For details on setting a property using the Property Dictionary, see Adding or modifying properties.
  • To set the default retention period for job runs of a specific job, set the RESULTS_RETENTION_TIME property using the Properties tab for a specific job. For information about setting property values using the Properties tab for a system object (such as a job), see the Setting values for system object properties.

    Note

    The most specific retention value is used when executing a retention policy. For example, a specific job value overrides any value defined for the specific job type or for all job types.

To set the retention period for automatically-generated objects

To set the number of days to retain automatically-generated objects before marking them for deletion, do the following:

  1. Start the Application Server Administration console, as described in Starting the Application Server Administration console.
  2. Specify the retention period (in days) with the set command:
    set Cleanup AutoGeneratedRetentionTime #days
    where:
    #days — is the number of days that job and depot objects are retained before being marked for deletion (when you execute the retention policy utility). BMC typically recommends a value of 30 days for this retention time. If the number of days is not set, the default value is 0, and objects are not deleted.
  3. Restart the Application Server to have this change take effect.

To execute the retention policy utility

To execute the retention policy utility, schedule the cleanup script to run in TYPICAL mode or include the executeRetentionPolicy command in INDIVIDUAL mode (as described in Changing Database Cleanup script options and commands).