Purge Order

Purging of an order can be done in the following ways:

Purging through Database Scripts

Note: Only the orders that are in the final state (for example, CANCELED and COMPLETE) can be purged.

Run the following script to purge orders:

  • For order database: $OM_HOME/db/dbscripts/postgreSQL/order/bin/purge-orders.sh or $OM_HOME/db/dbscripts/oracle/order/purge-orders.sh

  • For archival database: $OM_HOME/db/dbscripts/postgreSQL/archival/bin/purge-orders.sh or $OM_HOME/db/dbscripts/oracle/archival/purge-orders.sh

Usage:

purge_orders.sh [ORDER_STATUS] [FROM_DATE] [TO_DATE] [COMMIT_SIZE] [PURGE_AUDIT]";E.g.: purge_orders.sh COMPLETE 26-04-201616:59:59 29-04-201617:59:59 10 YES";

For more information, see the purge_orders_ReadMe.txt file on the following locations:

  • PostgreSQL: $OM_HOME/db/dbscripts/postgreSQL/order/bin for the order database and $OM_HOME/db/dbscripts/postgreSQL/archival/bin for the archival database.

  • Oracle: $OM_HOME/db/dbscripts/oracle/order for the order database and $OM_HOME/db/dbscripts/oracle/archival for the archival database.

The default setting for enablePurgeCompleteOrder is true in the Orchestrator service. When this is true, orders are removed from the database once they reach a final state. As a result, APIs in the Orchestrator and Data Service stop working for any orders that have been purged. Therefore, if you want to keep using these APIs for orders after they are completed, you must set enablePurgeCompleteOrder to false.

Purging through Partitioning

Note: Only the orders that are in the final state (for example, CANCELED and COMPLETE) can be purged.

PostgreSQL

Run the following partitioning procedures by using the select drop_partition_by_name('<partition_date>'); command:

  • For order database: $OM_OME/db/dbscripts/postgreSQL/order/scripts/drop_partition_by_name.sql

  • For archival database: $OM_HOME/db/dbscripts/postgreSQL/archival/scripts/drop_partition_by_name.sql

For more information, see the $OM_HOME/db/dbscripts/postgreSQL/order/bin/drop_partition_by_name_Readme.txt file for the order database and $OM_HOME/db/dbscripts/postgreSQL/archival/bin/drop_partition_by_name_Readme.txt file for the archival database.

Oracle

Run the drop_partition_by_name.sql script to create TRUNCATEPARTITION procedure. To call the 'truncatepartition' procedure, give the following query:

 <call TRUNCATEPARTITION('partition');>
Note: Input partition must be in ORD_20220521010000 format.

For more information, see the $OM_HOME/db/dbscripts/oracle/order/drop_partition_by_name_Readme.txt file for the order database and $OM_HOME/db/dbscripts/oracle/archival/drop_partition_by_name_Readme.txt file for the archival database.