Running the Stored Procedure for Microsoft SQL Server

Note: The ec_delete_non_instance_audit stored procedure should only be executed once audit data for process instances and work items has been purged using the ec_delete_audit_stats_data stored procedure. If this is not done it may leave the audit trail for process instances or work items in an inconsistent state.

To run the stored procedure, enter the following commands:

EXEC ec_delete_non_instance_audit end_time, force_delete, batch_size, dbg

where:

  • end_time is the date before which the audit data will be purged.

    This is an optional parameter, if not specified all audit data will be deleted.

    The date should be in the format YYYY-MM-DDTHH:mm:ss.SSSTZ

    where:

    • YYYY-MM-DD is the date.
    • HH:mm:ss is the time, specified in the 24-hour format.
    • SSS is the 3-digit millisecond, and
    • TZ is the timezone. For example, UTC is represented by ’Z’.

      Following is an example of a valid date: 2010-10-08T13:35:37.977Z

  • force_delete indicates if the audit data should be force deleted.

    In normal operation audit events for process instances should have been purged if the ec_delete_audit_stats_data stored procedure has been executed.

    The ec_delete_non_instance_audit stored procedure will error if it identifies any process instance audit events within the threshold to be purged. If this happens it will not continue with the purge.

    It is recommended you check the audit trail to see if the audit events are required. If you wish to continue with the purge you could pass in 'TRUE' for this option.

    Note: This may leave the audit trail for process instances or work items in an inconsistent state.

    Valid values are:

    • 'TRUE' to switch on force_delete
    • ’FALSE' to switch off force_delete (default value)
  • batch_size is the number of audit events that should be deleted before the transaction is committed.

    This is a mandatory parameter and if not specified (or if 'NULL' or '0' is specified) it will default to 5000.

  • dbg is the debug flag which gives useful debug information. This is switched off by default. Valid values are:
    • ’TRUE' to switch on debug
    • ’FALSE' to switch off debug (default value)

      Examples

The following are examples of usage.

  • To delete audit data before the specified date:
    exec ec_delete_non_instance_audit '2010-10-08T13:35:37.977Z’
  • To delete all audit entries:
    exec ec_delete_non_instance_audit
  • To delete all audit entries with a different commit batch size (150):
    exec ec_delete_non_instance_audit NULL, NULL, 150
  • To delete all audit entries forcefully:
    exec ec_delete_non_instance_audit NULL, 'TRUE'