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:
The following procedure lets you enable or disable the retention policy.
set Cleanup EnableRetentionPolicy true|false
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.
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:
RESULTS_RETENTION_TIMEproperty for the Job property class in the Property Dictionary. For details on setting a property using the Property Dictionary, see Adding or modifying properties.
RESULTS_RETENTION_TIMEproperty for the specific job property class in the Property Dictionary (for example, the
SnapshotJobproperty 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.
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 number of days to retain automatically-generated objects before marking them for deletion, do the following:
set Cleanup AutoGeneratedRetentionTime #days
#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.
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).