Clearing Audit and Statistical Data for Process Instances
The audit entries of a process instance are not required once the process instance completes, is cancelled, or failed. You can use stored procedures to delete these audit entries and statistical data for COMPLETED, CANCELLED, and FAILED process instances.
Stored procedures for different databases such as Microsoft SQL Server, Oracle, and DB2 are available in your installation location. The installer installs the stored procedure for the database available at CONFIG_HOME\bpm\bpm_app_name\database\ec.
- The same functionality as in these procedures is available as an API provided by the EventCollectorManagementService. See the TIBCO ActiveMatrix BPM - BPM Developer’s Guide for details.
- Neither the EventCollectorManagementService API nor these stored procedures include any provision for backing up or archiving your database. TIBCO recommends that you backup your database, according to whatever backup strategy your organization has implemented, before initiating the procedure. Refer to the documentation supplied with your database server for information on how to do this.
How Detached Sub-Process Instances Are Handled When Purging Audit Data
The optional end_time parameter for the ec_delete_audit_stats_data stored procedure specifies the date before which a root process instance must have terminated (completed, cancelled, or failed) to be included in the purge list.
If a sub-process is invoked in Asynchronous Detached mode, the invoking call activity completes immediately and the process flow continues. The sub-process lifecycle is independent of the invoking process, so the sub-process instance may still be active when the parent process instance has terminated.
You should be aware that, by default, the termination time for detached sub-process instances is not considered when purging a root process instance, only the fact that they are terminated. If a root process instance meets the criteria to be included in the purge list, as specified by the end_time parameter, and all of its detached sub-process instances have terminated, those detached sub-process instances are also included in the purge list, even if they have only just terminated (and their termination time is after the date specified in the query) .
For example, suppose there is a main process (proc1) that invokes, in Asynchronous Detached mode, a single sub-process (subproc1). An instance of proc1 is started, invokes an instance of subproc1, and then completes. subproc1 runs as a detached instance, and completes 89 days after proc1 completed.
Two days after the subproc1 instance completed, ec_delete_audit_stats_data is run, with end_time set to 90 days. The proc1 instance is added to the purge list even though subproc1 only completed 2 days ago, because:
- proc1 completed 91 days ago (which is more than the 90 day threshold specified in end_time), and
- proc1 has no active, detached sub-process instances.
Audit data for the entire proc1 instance chain - including subproc1 - is then purged.
You can override this default behavior by setting the delete_active_subprocs parameter on the ec_delete_audit_stats_data stored procedure to true. If this parameter is set, audit data for the root process instance and its chain of sub-process instances will be purged even if any of those sub-process instances are active.