Friday, September 6, 2013

SOA 11g purge specific instances

You can delete specific instances via EM, but we wanted to delete it from database as we were facing issue on EM console batch delete mentioned here.

The OOTB purge process seems to be having some challenges:

DECLARE
  MIN_CREATION_DATE TIMESTAMP;
  MAX_CREATION_DATE TIMESTAMP;
  BATCH_SIZE NUMBER;
  MAX_RUNTIME NUMBER;
  RETENTION_PERIOD TIMESTAMP;
  PURGE_PARTITIONED_COMPONENT BOOLEAN;
  COMPOSITE_NAME VARCHAR2(200);
  COMPOSITE_REVISION VARCHAR2(200);
  SOA_PARTITION_NAME VARCHAR2(200);
BEGIN
  MIN_CREATION_DATE := systimestamp - 10000;
  MAX_CREATION_DATE := systimestamp;
  BATCH_SIZE := 20000;
  MAX_RUNTIME := 60;
  RETENTION_PERIOD := null;
  PURGE_PARTITIONED_COMPONENT := true;
  COMPOSITE_NAME := 'MyProcess';
  COMPOSITE_REVISION := '1.0';
  SOA_PARTITION_NAME := 'MyPartition';

  SOA.DELETE_INSTANCES(
    MIN_CREATION_DATE => MIN_CREATION_DATE,
    MAX_CREATION_DATE => MAX_CREATION_DATE,
    BATCH_SIZE => BATCH_SIZE,
    MAX_RUNTIME => MAX_RUNTIME,
    RETENTION_PERIOD => RETENTION_PERIOD,
    PURGE_PARTITIONED_COMPONENT => PURGE_PARTITIONED_COMPONENT,
    COMPOSITE_NAME => COMPOSITE_NAME,
    COMPOSITE_REVISION => COMPOSITE_REVISION,
    SOA_PARTITION_NAME => SOA_PARTITION_NAME
  );
--rollback; 
END;    

  • Procedure doesn't allow selective purge - e.g. I can not purge specific list of instance ids
  • Procedure runs pruning job which basically prevents purging faulted or running instances
Here is workaround :

  • Insert the ecid in ecid_purge table. Below is sample query, but select statement can be changed as you like.
truncate table ecid_purge;
insert into ecid_purge   select distinct ecid from composite_instance where composite_dn  like '%CustomerParty/SyncCustomerPartyListEBizProvABCSImpl!1.0%';  
commit; 

  • Run the following procedure to clean up the data. It will clean up faulted and open running instances as well
begin
  soa_orabpel.deleteComponentInstances('ecid_purge',true);
  soa_workflow.deleteComponentInstances('ecid_purge');
  soa_mediator.deleteComponentInstances('ecid_purge');
  soa_decision.deleteComponentInstances('ecid_purge');
  soa_fabric.deleteCompositeInstances('ecid_purge',true);
  commit;
end;


No comments: