Deleting Large Numbers of Instances with the Purge Script

Managing Database Growth 9-5

9.3.1 Looped Purge Script

The master purge script includes a looping construct that allows for a batched purge. You can also provide this script with a max_runtime parameter that stops looping after the value for this parameter is exceeded. The master script drives the purge of SOA database tables. You can use the delete_ instances procedure to purge SOA database tables.

9.3.1.1 delete_instances Procedure

Use the delete_instances procedure to delete instances. Example 9–1 shows the syntax. Example 9–1 delete_instances Procedure Syntax procedure delete_instances min_creation_date in timestamp, max_creation_date in timestamp, batch_size in integer, max_runtime in integer, retention_period in timestamp, purge_partitioned_component in boolean ; Table 9–1 describes the script parameters. Notes: ■ If you use the purge_soainfra_oracle.sql PLSQL script provided in releases before 11g Release 1 11.1.1.4, note that this script is only supported on Oracle databases. There is no purge script support on the Microsoft SQL Server or IBM DB2 database, either with the purge_soainfra_oracle.sql purge script or with the newer purge script provided with release 11g Release 1 11.1.1.4 or later. Only Oracle databases are supported. ■ The purge_soainfra_oracle.sql PLSQL purge script provided in pre-11.1.1.4 releases has been deprecated. If you are an existing user of this script, you can continue to use it against your database in 11g Release 1 11.1.1.4 or later. However, starting with 11g Release 1 11.1.1.4, this script is no longer shipped. Oracle recommends that you use the purge script provided with 11g Release 1 11.1.1.4 or later. ■ When upgrading from 11g Release 1 11.1.1.3 to 11g Release 1 11.1.1.4 or 11g Release 1 11.1.1.5, ensure that you run the purge setup scripts from the 11.1.1.4 RCU or 11.1.1.5 RCU location, respectively, as this contains the latest purge details. For more information about upgrade, see Oracle Fusion Middleware Upgrade Guide for Oracle SOA Suite, WebCenter, and ADF. Note: Set max_runtime to a higher value if there are many instances to purge. In this case, you should expect to wait for a longer time before the script exits. Alternatively, use a smaller batch size if you want the purge script to exit sooner. 9-6 Oracle Fusion Middleware Administrators Guide for Oracle SOA Suite and Oracle BPM Suite

9.3.2 Looped Purge in Parallel Script with dbms_scheduler

This script is functionally the same as the looped purge script described in Section 9.3.1, Looped Purge Script. However, this script uses the dbms_scheduler package to spawn multiple purge jobs, with each job working on subset data. You can use the following procedure to purge SOA database tables. Table 9–1 delete_instances Procedure Parameter Descriptions Parameter Description min_creation_date Beginning creation date for the composite instances. max_creation_date Ending creation date for the composite instances. batch_size Batch size used to loop the purge. The default value is 20000. max_runtime Expiration at which the purge script exits the loop. The default value is 60. This value is specified in minutes. retention_period Retention period is only used by the BPEL process service engine in addition to using the creation time parameter. This functionality is not extended to other components. This parameter checks for and deletes records in the cube_ instance table. The value for this parameter must be greater then or equal to max_creation_date. The default value is null. Specify a retention period if you want to retain the composite instances based on the modify_date of the BPEL instances cube_instance. In this example, the modify_date of the BPEL instances table, which can be different than the composite created_ date, is used as a second level of filtering: min_creation_date = 1st June 2011 max_creation_date = 30 June 2011 retention_period = 1st July 2011 This deletes all composite instances in which the creation_ time of the composite is between 1st June 2011 and 30 June 2011 and the modify_date of the cube_instance is less than 1st July 2011 purge_partitioned_ component Users can invoke the same purge to delete partitioned data. The default value is false. Note: If you do not provide a value for retention_period, the value for this property defaults to the value of max_creation_date this is, if retention_period equals null, then retention_ period = max_creation_date. This consequence also applies to the script parameters described in Section 9.3.2, Looped Purge in Parallel Script with dbms_scheduler.