11. Manage Erase Groups

Erase groups physically delete PSA data after a retention period (see Delete Logic). PSA tables that are not covered by an erase group are kept indefinitely.

11.1. Add an Erase Group

Add an erase group with API_REDADM.ADD_ERASE_GROUP:

p_std_retention

Standard retention in days: rows whose functional validity (BDATE_TO, or BDATE for Type-3 tables) ended longer ago are deleted (default 99999).

p_tdate_closed_retention

Retention in days of technically superseded rows (TDATE_TO) (default 99999).

p_spec_cal_name, p_spec_cal_key, and p_spec_retention

Type-3 tables only: the days of this calendar key are kept for the special retention instead of the standard retention, e.g. month-end data for ten years.

p_active

Activates the erase group (default true).

Example: Keep Data for 7 Years, Month-End Data for 10 Years

 1EXECUTE SCRIPT API_REDADM.ADD_ERASE_GROUP(
 2    'SALES_7Y'                       -- p_erase_group
 3   ,'sales data, 7 years'            -- p_description
 4   ,2555                             -- p_std_retention
 5   ,2555                             -- p_tdate_closed_retention
 6   ,'AT'                             -- p_spec_cal_name
 7   ,'BU'                             -- p_spec_cal_key
 8   ,3650                             -- p_spec_retention
 9   ,false                            -- p_active
10);

The erase group is stored in REDADM.RED_ERASE_GROUPS. It is created inactive here, so that the assigned objects can be checked first.

11.2. Assign PSA Tables

Assign PSA tables and BDomains to the erase group with API_REDADM.ADD_EG_OBJ_DISCOVER_RULE. The rule has include and exclude patterns (regular expressions) for BDomain, PSA schema, and PSA table; include patterns default to ‘.*’.

Example: Assign All Tables of the Schema PSA_SALES

 1EXECUTE SCRIPT API_REDADM.ADD_EG_OBJ_DISCOVER_RULE(
 2    1                                -- p_rule_id
 3   ,'SALES_7Y'                       -- p_erase_group
 4   ,'.*'                             -- p_bdomain_incl_pattern
 5   ,null                             -- p_bdomain_excl_pattern
 6   ,'PSA_SALES'                      -- p_schema_incl_pattern
 7   ,null                             -- p_schema_excl_pattern
 8   ,'.*'                             -- p_object_incl_pattern
 9   ,null                             -- p_object_excl_pattern
10   ,'all sales tables'               -- p_rule_comment
11);

Check the result before activating the group:

  • REDADM.RED_EG_OBJECTS lists the assigned PSA tables and BDomains with their retention values.

  • REDADM.RED_EG_OBJECTS_AMBIGUOUS must be empty: a table and BDomain must not be assigned to more than one erase group, otherwise the deletion run is aborted.

  • The view <PSA_TABLE>_DEL of each PSA table shows the rows that would be deleted.

11.3. Activate the Erase Group

Activate the erase group with API_REDADM.TOGGLE_ERASE_GROUP or API_REDADM.MODIFY_ERASE_GROUP.

Example: Activate the Erase Group

1EXECUTE SCRIPT API_REDADM.TOGGLE_ERASE_GROUP(
2    'SALES_7Y'                       -- p_erase_group
3);

Warning

Deleted rows can only be restored from a database backup.

The deletion runs weekly (job eg_delete, Sunday 16:00). Each run is logged in REDADM.RED_PSA_DEL_CONTROL and, per PSA table and load run, in REDADM.RED_PSA_DEL_CONTROL_DETAIL.

Erase groups are removed with API_REDADM.REMOVE_ERASE_GROUP, rules with API_REDADM.REMOVE_EG_OBJ_DISCOVER_RULE.