Working with the Clean-up Utility

The Clean-up Utility DB-Cleanup.exe is a command line utility that can be used to delete workflow Executions, Packages, Artifacts, and History Records in the database.

Important! Stop the Release Manager before running the DB-Cleanup tool to avoid conflicts in the database.

This page includes the following:

About the Clean-up Utility

After running CDA for a while, the CDA database may contain an increasing number of outdated records, especially from workflow executions. To keep the size of the Automic Continuous Delivery Automation database small and ensure a good performance, you may want to remove outdated records. To do so, you can run the Clean-up Utility.

Important! The Clean-up Utility requires a direct database connection and operates through SQL statements. Therefore, the computer hosting the utility must allow a connection to the CDA database server.

The user specified in the connection string must have CRUD privileges on all tables of the CDA database and the right to create temporary tables in the database.

Installing the Clean-up Utility

If the Clean-up utility DB-Cleanup.exe is not already available on your system, perform the following steps.

To Install the Clean-Up Utility

Tip: Save the Clean-Up Utility in the following folder: C:\Automic\Release.Manager\Utilities

  1. Copy the DB-Cleanup.exe file to a computer which has access to the CDA database server.
  2. Configure the clean-up utility according to your needs.

    See: Configuring DB-Cleanup.exe.config File

Configuring DB-Cleanup.exe.config File

Note: The DB-Cleanup.exe.config file must be stored in the same folder as the DB-Cleanup.exe.

The parameters are organized in the following sections:

Both sections can be encrypted.

Tip: You can set fixed parameters (for example, Application names) with <add key> tags. For example: <add key "applications" value="MyApp1,MyApp2">

Parameters

You can pass every parameter either via XML configuration file Db-Cleanup.exe.config or directly together with the command line call (Both, dash- and colon-syntax are supported to pass parameters).

Rules for combining parameters:

Case-sensitivity of parameters depends on the underlying database:

Available Commands

You can run the following commands:

Important! If no command is specified, executions are cleaned up.

Examples

\DB-Cleanup.exe historyrecord

Input Parameters

Common Parameters

The following parameters can be used with all available commands:

Execution Parameters

Conditions for Deleting Executions

The Clean-up Utility only deletes a record if all of the following conditions are fulfilled:

Artifact Parameters

Command name: artifact

Conditions for Deleting Artifacts

The Clean-up Utility only deletes a record if all of the following conditions are fulfilled:

Package Parameters

Command name: package

Important! Packages belonging to an execution, a patch chain, a package workflow instance (package hook), or a current installation cannot be deleted, regardless of the --force flag or any other criteria.

If you set an invalid value for a parameter, the tool prints an error message informing about invalid parameters and quits.

Conditions for Deleting Packages

The Clean-up Utility only deletes a record if all of the following conditions are fulfilled:

History Records

Command name: historyrecord

Return Codes

After each run, the Clean-up utility returns an exit code to indicate the outcome of action. You may use this code in a script.

The utility returns the following codes:

Configuration Files

Common parameters can be specified in the configuration file with the same name as in the command line parameter.

<appSettings>
   <add key="verbose" value="max" />
   <add key="force" value="false" />
 </appSettings>

Command-specific parameters have the following format: [commandname].<parameter_name>

Example:

<appSettings>
   <add key="verbose" value="max" />
   <add key="force" value="false" />
   <add key="package.keepAtLeast" value="100" />
   <add key="package.olderThan" value="90" />
 </appSettings>

Command-specific parameters without prefix are considered as execution parameters:

<appSettings>
   <add key="verbose" value="max" />
   <add key="force" value="false" />
   <add key="keepAtLeast" value="100" /> <!-- this is considered as an execution command parameter -->
 </appSettings>

Examples

Examples for CLI calls and configuration file

Dash-syntax:

\DB-Cleanup.exe --olderThan 120 --archivedOnly true --applications "CRM System"

Colon-syntax:

\DB-Cleanup.exe olderThan:120 archivedOnly:true applications: "CRM System"

DB-Cleanup.exe.config:

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<connectionStrings> <add name="Database" connectionString="Data Source=##DB SERVER##;Initial Catalog=##DB NAME##;User ID=##DB USER##;Password=##DB PASSWORD##"/> </connectionStrings>

<appSettings> <add key="verbose" value="max"/> <add key="force" value="false"/> </appSettings>

</configuration>

See also: