1. Restore PSA Tables to a Point in Time¶
A partial restore resets selected PSA tables of selected BDomains to their state at a point in time, e.g. after a faulty delivery has been loaded. Other tables and BDomains are not touched. The APIs are in the schema API_REDRST.
A partial restore consists of these steps:
Initialise the restore.
Add the tables and BDomains to be restored.
Execute the restore.
Only one restore can be open at a time.
1.1. Initialise the Restore¶
Initialise the restore with API_REDRST.INIT:
- p_restore_ts
The point in time to which the tables are reset (format
YYYY-MM-DD HH24:MI:SS.FF3). All PSA loads at or after this time are removed.- p_include_tsa
If true, the TSA data of the removed loads is deleted as well, so that the data can be delivered and loaded again (default false).
Example: Initialise a Restore to 1 October 2024
1EXECUTE SCRIPT API_REDRST.INIT(
2 '2024-10-01 00:00:00.000' -- p_restore_ts
3 ,'Reload HR after faulty delivery' -- p_description
4 ,true -- p_include_tsa
5);
1.2. Add the Tables¶
Add the PSA tables and BDomains with API_REDRST.ADD_OBJECT. With p_use_regexp true, BDomain, schema, and table are regular expressions; otherwise they are exact names. The call can be repeated for further tables.
Example: Add All EMPLOYEE Tables of BDomain ‘HR’
1EXECUTE SCRIPT API_REDRST.ADD_OBJECT(
2 'HR' -- p_bdomain
3 ,'PSA_HR' -- p_schema_name
4 ,'EMPLOYEE.*' -- p_table_name
5 ,true -- p_use_regexp
6);
The restorable tables are listed in REDRST.RST_OBJECTS_OVERVIEW, the tables of the open restore in REDRST.RST_OBJECTS_PENDING.
1.3. Execute the Restore¶
Execute the restore with API_REDRST.EXECUTE. During the restore the framework is suspended, and all changes are applied in a single transaction:
All PSA rows loaded at or after the restore point are deleted, and the versions that were valid at the restore point are reopened.
If requested, the corresponding TSA data is deleted.
Application actions created after the restore point are reset, so that they run again after the reload.
With p_resume true, the framework is resumed afterwards; otherwise it stays suspended, e.g. to check the result first.
Example: Execute the Restore and Resume the Framework
1EXECUTE SCRIPT API_REDRST.EXECUTE(
2 true -- p_resume
3);
Warning
The removed data can only be restored from a database backup. Check the tables in REDRST.RST_OBJECTS_PENDING carefully before executing the restore.
After the restore, the PSA loads of the affected tables run again from the remaining or newly delivered TSA data. The restore history is kept in REDRST.RST_LOG and REDRST.RST_OBJECTS.
1.4. Handle Errors¶
If the restore fails, the transaction is rolled back, the error is written to REDRST.RST_LOG, and the framework stays suspended.
API_REDRST.REPAIR resets a failed or interrupted execution, so that it can be executed again.
API_REDRST.RESET removes the tables of the open restore; with p_include_init true, the open restore itself is removed as well.
Resume the framework manually if it stays suspended (redctl resume on the RED server, see the RED-PSS Guide).