Example weekly database cleanup plan
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:
How to set and enable retention times
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.
| Step | Example screen |
---|---|---|
1 | 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.
|
|
2 | We will be using the TrueSight 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. |
|
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: | |
4 | To enable the retention policy. Enter the following command:set Cleanup EnableRetentionPolicy true | |
5 | For your changes to take effect, restart the Application Server. Perform the following steps:
For alternative methods, see Restarting Application Servers. |
|
How to schedule a weekly database cleanup
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 Performing online database cleanup.)
| Step | Example screen |
---|---|---|
1 | To open the job in the TrueSight 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. | |
4 | Save the job to apply all changes. |
|
Where to go from here
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 TrueSight 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.
In addition to the standard weekly cleanup job, schedule a monthly cleanup of the agents, repeater server, and Application Server caches. Create cleanup jobs set to individual modes CLEAN_AGENT, CLEAN_REPEATER, and CLEAN_ALL_AS, and optionally include these three jobs within a batch job. For best results, keep these cleanup jobs separate from database cleanup (for example, do not include database cleanup in the same batch job).