This topic walks you through an example end-to-end process of setting up a database cleanup plan. The cleanup plan described here is based on a cleanup job that runs once a week, according to the frequency recommended by BMC for standard cases (that is, for databases that contain BSA data in an amount that can be handled effectively by the online DB cleanup mechanism).
This topic includes the following sections:
Before running Database Cleanup Jobs, you must set retention periods for two types of BSA data. You must also enable a retention policy, so that data that is older than the defined retention periods is marked for deletion. For more information about tasks related to retention periods and the retention policy, see Marking data for deletion. Set a retention period for job run data and job results through the Property Dictionary. In this example we define a retention period of 30 days (the length of time recommended by BMC) for all jobs of all types. In the BMC Server Automation Console, from the Configuration menu, select Property Dictionary View. In the Property Class Navigation pane, expand the Built-in Property Classes node, and select the Job property class. In the property list on the right, select the Properties tab. Select the Ensure that the Use this default value check box is selected, and then, in the Default value column, enter 30 as your retention period value (in days). Note For more information about setting properties through the Property Dictionary, see Adding or modifying properties. This retention time is not applied to the audit trail, job run events (that is, job run log messages), and job schedules. These data types accumulate faster than the other types of job data. Therefore, they have a shorter default retention time of 14 days. We will be using the BMC Server Automation Application Server console (the blasadmin utility) to set a retention period for auto-generated objects and to enable the retention policy. To start the Application Server Administration console, perform the following step: For alternative methods, see Starting the Application Server Administration console. For your changes to take effect, restart the Application Server. Perform the following steps: For alternative methods, see Restarting Application Servers.How to set and enable retention times
Step Example screen 1 RESULTS_RETENTION_TIME
property, and then click Edit Property.2 ./br/blasadmin
3 Auto-generated objects typically include BLpackages involved in compliance remediation or patch remediation, as well as Deploy Jobs and Batch Jobs from these remediation processes. To specify a retention period for auto-generated objects, enter the following command: set Cleanup AutoGeneratedRetentionTime 30
In this example, we are setting the retention time to 30 days, as recommended by BMC.4 To enable the retention policy. Enter the following command:
set Cleanup EnableRetentionPolicy true5
To perform a weekly online database cleanup, you schedule an NSH Script Job named BSA Recommended Database Cleanup Job to run once a week. This job is provided out-of-the-box. In addition to scheduling the job, you must configure several of the parameters that the job inherits from the BSA Recommended Database Cleanup Script. (For more about these out-of-the-box objects, see Default database cleanup script folders and files.)
Step | Example screen | |
---|---|---|
1 | To open the job in the BMC Server Automation console, expand the Jobs folder and then navigate to BMC Maintenance > BSA Recommended Database Cleanup Job. Right-click the job and select Open. | |
2 | To customize job parameters, in the content editor on the right click the Parameters tab, and then perform the following steps:
For more information about the script parameters, see Script parameters. |
|
3 | To schedule the job to execute once a week, perform the following steps:
It is recommended that you run this job at a time of low workload in your environment (such as the weekend). In this example, the job is scheduled to run every Saturday night. Note If you use BMC Decision Support for Server Automation to create reports, be careful that your weekly cleanup job does not overlap the weekly ETL job for loading data to the reporting data warehouse. Typically, you first run the ETL job, and only after the ETL job has finished you run the database cleanup job. It is not recommended to run cleanup while running updates of database statistics (Oracle or SQL Server), so as not to impact the performance of the environment. | |
4 | Save the job to apply all changes. |
For more complicated situations, where you have accumulated large amounts of BladeLogic data in the database, whether due to failures in the basic weekly cleanups or due to the large size of your operational environment, you might need to schedule additional, more frequent jobs to clean up data (especially historical data). Such jobs use the same out-of-the-box cleanup job, but are configured to execute individual delete commands (that is, are set to run in an execution mode that is not TYPICAL). For more information and recommendations, see Example cleanup plan for large operational environments.
In more extreme cases, you might have to plan a period of downtime for your BMC Server Automation Application Server so that you can perform offline database cleanup, a more forceful cleanup mechanism that will enable you to catch up on database maintenance. Afterwards, you should again be successful in maintaining your database using the basic weekly online database cleanups.