Developing a Purging and Partitioning Methodology

Managing Database Growth 9-7

9.3.2.1 delete_instances Procedure in Parallel

Use the delete_instances procedure in parallel to delete instances. Example 9–2 shows the syntax. Example 9–2 delete_instances Procedure in Parallel Syntax PROCEDURE delete_instances_in_parallel min_creation_date in timestamp, max_creation_date in timestamp, batch_size in integer, max_runtime in integer, retention_period in integer, DOP in integer max_count integer, purge_partitioned_component in boolean Table 9–2 describes the script parameters.

9.3.3 Purge States

Instances in the following states are purged with the purge scripts. ■ Completed successfully ■ Faulted Note: If you have a multiple CPU host, use of the parallel script can be beneficial. However, Oracle recommends that you enable the parallel script only during off hours. In addition, when purging data during off hours, Oracle recommends that you drop indexes before purging large amounts of data and then add the indexes back in. This speeds up the purge process, and also keeps indexes from becoming unbalanced. Table 9–2 delete_instances in Parallel 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 time 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 only in addition to using the creation time parameter. The default value is null. For more information about this parameter, see Table 9–1 . DOP Defines the number of parallel jobs to schedule. The default value is 4. max_count Defines the number of rows processed not the number of rows deleted. A big temp table is created and then jobs are scheduled to purge based on the data. This is the maximum purge row count to use; it defaults to one million. The default value is 1000000. purge_partitioned_ component Users can invoke the same purge to delete partitioned data. The default value is false. 9-8 Oracle Fusion Middleware Administrators Guide for Oracle SOA Suite and Oracle BPM Suite ■ Terminated by user ■ Stale ■ Unknown instance tracking is disabled Purging of the following instance states is not supported: ■ Instances pending recovery at the BPEL process service engine level or SOA composite application level ■ Running instances To purge these instances, you must first move them to one of the instance states supported by the purge scripts.

9.3.4 Executing the Purge Scripts

This section describes how to execute the purge scripts. To execute the purge scripts: 1. In SQLPlus, connect to the database AS SYSDBA: CONNECT SYS AS SYSDBA

2. Execute the following SQL commands:

GRANT EXECUTE ON DBMS_LOCK to USER; GRANT CREATE ANY JOB TO USER; where USER is the soainfra account to execute the scripts. These privileges are required to run the scripts.

3. Load the purge scripts by executing the main purge script in RCU_

HOME rcuintegrationsoainfrasqlsoa_purge. For a parallel purge, the debug logs from the jobs spawned by a parallel purge are logged into files created in the directory named SOA_PURGE_DIR. This directory must be accessible to the Oracle database.

4. Create SOA_PURGE_DIR and grant write permissions to the soainfra user.

mkdir -p tmppurgelog CREATE OR REPLACE DIRECTORY SOA_PURGE_DIR AS ’SERVER_DIRECTORY’ where SERVER_DIRECTORY is the name of the directory to create for example, tmppurgelog. Note the required single quotes around the directory path. 5. If you want to execute the scripts in debug mode, run commondebug_on.sql and set serverout to on in SQLPlus. This step is optional. SET SERVEROUTPUT ON The logs from the spawned jobs are logged into the directory created in Step 4 separate files per job. The rest of the logs are displayed on stdout or the spool file, if configured. There are two options for purging: ■ Looped purge ■ Parallel purge 6. Execute the purge scripts as shown below. Examples are provided for both options.