Performing online database cleanup
The online database cleanup mechanism enables you to delete various BMC Server Automation elements from the database, while the BMC BladeLogic Server Automation Application Server is running (that is, without the need for Application Server downtime). This mechanism helps you control the growth of BMC Server Automation data, by deleting unused data that is no longer needed for BMC Server Automation operations.
The online database cleanup mechanism deletes data in the database that was previously marked for deletion (that is, data that was soft-deleted). This includes the following types of data:
- Objects that users have already deleted in the BMC Server Automation Console.
- Objects older than a certain age, as defined by a retention policy. These objects include old job runs and job and depot objects automatically generated by operations such as auto-remediation and patch analysis. These objects are marked for deletion when you execute the retention policy. For more information about the various types of data objects that are usually included in a cleanup job, see Types of data commonly included in cleanups.
The online database cleanup mechanism involves the following elements:
Various BLCLI commands in the Delete namespace.
- An out-of-the-box, default Network Shell script that executes several of the BLCLI commands. This script is named BSA Recommended Database Cleanup Script, and it is stored in the BMC Maintenance folder in the depot.
- An out-of-the-box, default Network Shell Script Job that runs the Network Shell script. This job is named BSA Recommended Database Cleanup Job, and it is stored in the BMC Maintenance job folder.
When the Application Server is installed, the installation program creates a folder called autoimportcontent/nshscripts in the NSH/br/ directory, and places a dbcleanup.zip file in that directory. When the Application Server is started, the dbcleanup.zip file is automatically imported and unzipped.
Because the import of the script and job can continue even after the Application Server starts, you might not immediately see the cleanup NSH script and cleanup NSH script job in the console. The entire process might take a few minutes.
To ensure that your BMC Server Automation database does not grow to an unmanageable size, you must proactively set up a database cleanup plan that runs database cleanup jobs at regular intervals based on the out-of-the-box script. For examples of such database cleanup plans, see Example weekly database cleanup plan and Example cleanup plan for large operational environments.
Before you start the cleanup process, it is recommended to check the state of your database. For various methods to do this, see Determining the state of the database before or during cleanup.
To set up an online database cleanup plan
- Configure a data retention policy for job run data and auto-generated objects, and enable your retention policy. For more information about this task, see Marking data for deletion.
For the configuration of your cleanup job, choose one of the following strategies:
- Customize the provided out-of-the-box cleanup job; adjust the parameters in the job and schedule it to run at a regular (usually weekly) interval. For an example of this strategy, see Example weekly database cleanup plan.
- For more granular control over the cleanup process, create copies of the out-of-the-box cleanup job for individual execution modes. You can then organize various types of cleanups in batch jobs that you schedule to run at regular intervals. For an example of this strategy, see Example cleanup plan for large operational environments.
Open your cleanup job (or each of your multiple cleanup jobs), and customize the parameters (which are inherited from the NSH script) within the job. This involves the following tasks:
Adjust the script parameters through the script-based cleanup job, as discussed in Configuring parameters in the script-based cleanup job.
Schedule job execution at regular intervals, as discussed in Scheduling the script-based cleanup job.