Example cleanup plan for large operational environments
This topic walks you through an example end-to-end process of setting up a comprehensive plan for cleaning up your BMC Server Automation (BSA) database in a large operational environment, where the database fills up quickly, and the standard weekly cleanup plan (described in Example weekly database cleanup plan) is not sufficient. This cleanup plan can also be used in situations where you have accumulated large amounts of BladeLogic data in the database due to failures in the basic weekly cleanups, and you need to temporarily apply a more forceful cleanup plan to catch up on database maintenance.
The cleanup plan described here involves a combination of cleanup jobs organized within Batch Jobs and scheduled to run on a frequent basis (mostly daily, some weekly). Setting up the cleanup plan involves the following tasks:
- Define retention periods.
- Create multiple cleanup jobs based on the default cleanup job that is provided out-of-the-box. Each of these jobs is designed to perform an individual cleanup function.
- Organize the various cleanup jobs that you created (in the previous task) as the building blocks in more complex Batch Jobs — one for the daily cleanup of historical data, and the other for weekly hard deletion of additional data that is not fully deleted by the daily job.
This topic includes the following sections:
Failed to execute the [excerpt-include] macro.
How to create jobs for individual cleanup functions
For greater control over the various cleanup functions, we will create multiple copies of an out-of-the-box NSH Script Job named BSA Recommended Database Cleanup Job, and customize each new job to perform an individual cleanup function (that is, to execute an individual delete command). In each of these new jobs, we will customize the job parameters, which are inherited from the BSA Recommended Database Cleanup Script. All these jobs will serve as the building blocks in the next task, when we organize the individual cleanup jobs in Batch Jobs. (For more about the out-of-the-box script and job, see Default-database-cleanup-script-folders-and-files.)
| Step | Example screen | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
1 | To create your first copy of the default cleanup job, perform the following steps:
| |||||||||
2 | To open the new job, right-click Copy of BSA Recommended Database Cleanup Job, and select Open. | |||||||||
3 | In the content editor on the right, on the General tab, change the name of this new job to Cleanup AuditTrail, and the description to Cleanup of the Audit Trail. Then click Save | |||||||||
4 | To customize job parameters, click the Parameters tab, and then make the following changes to parameter settings:
For more information about the script parameters, see Script parameters. | |||||||||
5 | Save the job again to apply all changes. |
| ||||||||
6 | Repeat steps 1 to 5 for another 12 cleanup functions. The following table lists all 13 cleanup jobs that you need to create, and includes the name for each job (to rename in step 3) and the parameter settings that you need to adjust (in step 4). Tip: To speed up the process of creating these jobs, choose a source job (in step 1) with parameter settings that are similar to those of the target job. For example, to create the Cleanup JobRunEvent job, copy the Cleanup AuditTrail job and adjust just the job name and description and the ObjectType parameter. You can also paste multiple copies of the same source job. |
|
Job names and parameters to adjust in the cleanup jobs for individual cleanup functions
Job name | Execution | Object | Retention | Other |
---|---|---|---|---|
Cleanup AuditTrail | HISTORY_ORDR | AuditTrail | 30 | Set to ignore: MaxDuration Do not change: ContinueOnError |
Cleanup JobRunEvent | HISTORY_ORDR | JobRunEvent | ||
Cleanup JobSchedule | HISTORY_ORDR | JobSchedule | ||
Cleanup AuditResult | HISTORY_ORDR | AuditResult | set to ignore | Set to ignore: MaxDuration Do not change: ContinueOnError |
Cleanup ComplianceResult | HISTORY_ORDR | ComplianceResult | ||
Cleanup Deploy | HISTORY_ORDR | Deploy | ||
Cleanup PatchResult | HISTORY_ORDR | PatchResult | ||
Cleanup SnapshotResult | HISTORY_ORDR | SnapshotResult | ||
Cleanup AppServerCaches | CLEAN_ALL_AS | set to ignore | 30 | Set to ignore: MaxDuration Do not change: ContinueOnError |
Cleanup Database | CLEAN_DB | set to ignore | set to ignore | Set to ignore: MaxDuration Do not change: ContinueOnError |
Cleanup Shared Objects | CLEAN_SHARED_OBJECTS | |||
Cleanup FileServer | CLEAN_FS | |||
Cleanup Retention | RETENTION |
How to organize the individual cleanup jobs into Batch Jobs for a comprehensive cleanup plan
We will now organize the various cleanup jobs that we prepared into two Batch Jobs — one for the daily cleanup of historical data, and the other for weekly hard deletion of additional data that does not get deleted by the daily job. The daily cleanup job is a relatively complex Batch Job, with another two Batch Jobs nested within it (one within the other). The hierarchical organization of cleanup jobs within these Batch Jobs is as follows:
- Daily cleanup of historical data:
Batch Job named Daily Cleanup. This job contains the following jobs, set to run sequentially:- Cleanup Retention
- Batch Job named Cleanup Historical, with the following jobs set to run in parallel:
- Batch Job named Cleanup Results, with the following cleanups set to run sequentially:
- Cleanup AuditResult
- Cleanup SnapshotResult
- Cleanup ComplianceResult
- Cleanup PatchResult
- Cleanup Deploy
- Cleanup JobRunEvent
- Cleanup AuditTrail
- Cleanup JobSchedule
- Batch Job named Cleanup Results, with the following cleanups set to run sequentially:
- Cleanup AppServerCaches
- Weekly hard delete cleanup:
Batch Job named Weekly Cleanup. This job contains the following jobs, set to run sequentially:- Cleanup Retention
- Cleanup Database
- Cleanup Shared Objects
- Cleanup FileServer
The following instructions guide you through the creation of these Batch Jobs. For the daily cleanup job, we will start with the creation of the most nested, lowest-level Batch Job, and work our way upward and outward until we have created the final daily Batch Job.
| Step | Example screen |
---|---|---|
1 | To create the most nested Batch Job, which groups together the cleanup of job results, perform the following steps:
| |
2 | To create the next Batch Job, which groups together the cleanup of historical data, perform the following steps:
| |
3 | To create the final Batch Job for daily cleanup of historical data, perform the following steps:
| |
4 | To create the weekly Batch Job for hard deletion of other types of data, perform the following steps:
|
Where to go from here
If you set up this cleanup plan as a temporary means for catching up on the deletion of old data that accumulated in your database, you can follow the current plan for several weeks and then revert back to the basic plan described in Example-weekly-database-cleanup-plan.
For more complicated situations, where you have accumulated large amounts of BladeLogic data in the database, you might need to plan a period of downtime for your BMC Server Automation Application Server so that you can perform a one-time offline database cleanup, a more forceful cleanup mechanism.