You are on page 1of 9

APPLIES TO:

Oracle SOA Suite - Version 11.1.1.1.0 to 12.2.1.0.0 [Release 11gR1 to 12c]


Information in this document applies to any platform.

GOAL
Show how to run the purge scripts step by step.
Show also how to monitoring the current purge script execution.
Also include queries to get information before and after running the purge
scripts.

SOLUTION
This note show how to run the purge script step by step and other tips to do
understand the purge scripts execution.

This is the first query executed by the purge scripts to know the ecid
feasible to be delete.

select unique(ecid) from composite_instance where (


bitand(state,127)=1 or
bitand(state,16)=16 or
bitand(state,64)=64 or state between 32 and 63 or
state = 3 or state =19)
and created_time >= to_timestamp('2012-12-01','YYYY-MM-DD')
and created_time <= to_timestamp('2012-12-31','YYYY-MM-DD')
and ecid not in (select ecid from prune_running_insts );

As example you will got something like the following output:

ECID
---------------------------------------------------------------------------------------------------1357a44e35b4c3cd:32b103ab:13bb5484207:-8000-0000000000a29180
1357a44e35b4c3cd:32b103ab:13bb5484207:-8000-000000000091348b

1357a44e35b4c3cd:32b103ab:13bb5484207:-8000-0000000000a01bb9
1357a44e35b4c3cd:32b103ab:13bb5484207:-8000-00000000008eea46
1357a44e35b4c3cd:78cfa31f:13b62df6c03:-8000-0000000000000bee
1357a44e35b4c3cd:32b103ab:13bb5484207:-8000-00000000009cdc93
1357a44e35b4c3cd:32b103ab:13bb5484207:-8000-00000000008f015f
1357a44e35b4c3cd:-5f256b44:13bb540af47:-8000-000000000000065f
1357a44e35b4c3cd:32b103ab:13bb5484207:-8000-00000000008edb01
1357a44e35b4c3cd:32b103ab:13bb5484207:-8000-000000000091923b
1357a44e35b4c3cd:32b103ab:13bb5484207:-8000-00000000008ebfd7
1357a44e35b4c3cd:32b103ab:13bb5484207:-8000-0000000000918485
1357a44e35b4c3cd:78cfa31f:13b62df6c03:-8000-00000000000008f4
1357a44e35b4c3cd:32b103ab:13bb5484207:-8000-00000000008f112a

and also this query executed give 0 records:

select ecid from prune_running_insts;


with that we can assume that doesn't exists running instances.

C. To know the potential rows to be deleted on the cube instance we execute the following:

select to_char(CREATION_DATE, 'MM-YYYY'), state, count(*) from


BD25_SOAINFRA.cube_instance where state >= 5 group by
to_char(CREATION_DATE, 'MM-YYYY'), state;

TO_CHAR(CREATION_DATE,'MM-YYYY') STATE COUNT(*)


-------------------------------03-2013
11-2012
01-2013
05-2013
04-2013
03-2013
03-2013
03-2013
12-2012
05-2013
04-2013

-------------------------------------5
10
8
5
5
8
9
10
5
10
10

-------224372
2
1
10
28
1
4
58
3632
11
165

On the month of March exists 224372 potential to be dropped. If we execute the purge scripts for that month in particular

If we want to know the days in particular to be more exactly.

TO_CHAR(CREATION_DATE,'DD-MM-YYYY') STATE COUNT(*)


----------------------------------21-03-2013
27-03-2013
26-04-2013
07-01-2013
28-03-2013
20-03-2013
14-03-2013

-------------------------------------10
5
10
8
5
5
10

-------15
7
3
1
5
17
1

15-03-2013
29-04-2013
09-03-2013
16-04-2013
14-03-2013
23-04-2013
05-03-2013
08-03-2013
04-04-2013
08-04-2013
01-05-2013
21-03-2013
28-04-2013
23-04-2013
04-03-2013
16-04-2013
02-05-2013
22-03-2013
24-04-2013
07-12-2012
04-03-2013
10-04-2013
12-04-2013
17-04-2013
13-03-2013
01-03-2013
06-03-2013
07-03-2013
08-03-2013
15-04-2013
22-04-2013
12-04-2013
10-04-2013
02-05-2013
01-05-2013
25-04-2013
19-11-2012
04-03-2013
11-04-2013
22-04-2013

5
10
10
10
5
10
5
10
5
10
5
5
10
5
8
5
10
10
10
5
5
10
5
10
5
5
5
5
5
10
5
10
5
5
10
10
10
9
10
10

1
1
12
9
7
2
53742
9
6
24
2
11
3
4
1
8
1
21
11
3632
39708
48
7
1
8
8
53542
53752
23564
27
1
1
2
8
10
2
2
4
30
3

We will execute the purge scExecuting the purge scripts for that period
in particular. But before that, let's elaborate this file with the following:

[oracle@dbcomputer SQL]$ cat purgescript-month.sql


ALTER PROCEDURE debug_purge COMPILE PLSQL_CCFLAGS = 'debug_on:TRUE' REUSE SETTINGS;
ALTER PROCEDURE log_info COMPILE PLSQL_CCFLAGS = 'debug_on:TRUE' REUSE SETTINGS;
SET SERVEROUTPUT ON;
spool '/home/oracle/PurgeLogs/spool.log';
select to_char(CREATION_DATE, 'MM-YYYY'), state, count(*) from BD25_SOAINFRA.cube_instance where
state >= 5 group by to_char(CREATION_DATE, 'MM-YYYY'), state order by 1;
DECLARE
MAX_CREATION_DATE timestamp;
MIN_CREATION_DATE timestamp;
batch_size integer;

max_runtime integer;
retention_period timestamp;
BEGIN
MIN_CREATION_DATE := to_timestamp('2013-03-01','YYYY-MM-DD');
MAX_CREATION_DATE := to_timestamp('2013-03-31','YYYY-MM-DD');
max_runtime := 60;
retention_period := to_timestamp('2013-05-01','YYYY-MM-DD');
batch_size := 10000;
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 => false);
END;
/
select to_char(CREATION_DATE, 'MM-YYYY'), state, count(*) from BD25_SOAINFRA.cube_instance where
state >= 5 group by to_char(CREATION_DATE, 'MM-YYYY'), state order by 1;
spool off;
ALTER PROCEDURE debug_purge COMPILE PLSQL_CCFLAGS = 'debug_on:false' REUSE SETTINGS;
ALTER PROCEDURE log_info COMPILE PLSQL_CCFLAGS = 'debug_on:false' REUSE SETTINGS;

Create also the following file: sqlview.sql

column status format a10


set feedback off
set serveroutput on
select username, sid, serial#, process, status from v$session
where username is not null

/
column username format a20
column sql_text format a55 word_wrapped
set serveroutput on size 1000000
declare
x number;

begin
for x in
( select username||'('||sid||','||serial#||') ospid = ' || process ||' program = ' || program
username, to_char(LOGON_TIME,' Day HH24:MI') logon_time, to_char(sysdate,' Day HH24:MI')
current_time, sql_address, LAST_CALL_ET
from v$session where status = 'ACTIVE' and rawtohex(sql_address) <> '00' and username is not null
order by last_call_et )
loop
for y in ( select max(decode(piece,0,sql_text,null)) || max(decode(piece,1,sql_text,null)) ||
max(decode(piece,2,sql_text,null)) || max(decode(piece,3,sql_text,null)) sql_text from
v$sqltext_with_newlines where address = x.sql_address and piece < 4)
loop
if ( y.sql_text not like '%listener.get_cmd%' and y.sql_text not like '%RAWTOHEX(SQL_ADDRESS)%')
then
dbms_output.put_line( '--------------------' );
dbms_output.put_line( x.username );
dbms_output.put_line( x.logon_time || ' ' || x.current_time|| ' last et = ' || x.LAST_CALL_ET);
dbms_output.put_line(substr( y.sql_text, 1, 250 ) );
end if;
end loop;
end loop;
end;
/
column username format a15 word_wrapped
column module format a15 word_wrapped
column action format a15 word_wrapped
column client_info format a30 word_wrapped
select username||'('||sid||','||serial#||')' username, module, action, client_info from v$session
where module||action||client_info is not null;
quit;

Executing the previous script you will be able to inspect what is doing the purge scripts as example I got the
following output when I waiting for ending the purge scripts.

BD25_SOAINFRA(148,53) ospid = 13945 program = sqlplus@dbcomputer.localdomain (TNS V1-V3)

Mircoles 18:27 Mircoles 18:33 last et = 347


DELETE FROM HEADERS_PROPERTIES WHERE MESSAGE_GUID IN (SELECT MESSAGE_GUID FROM
TEMP_DOCUMENT_DLV_MSG_REF)

And Finally this is the way to run the purge scripts:

[oracle@dbcomputer SQL]$ sqlplus BD25_SOAINFRA/welcome1

SQL*Plus: Release 11.2.0.2.0 Production on Wed May 22 18:27:01 2013


Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> @purgescript-month.sql
Procedure altered.
Pocedure altered.
TO_CHAR STATE COUNT(*)
------01-2013
03-2013
03-2013
03-2013
03-2013
04-2013
04-2013
05-2013
05-2013
11-2012
12-2012

---------- ---------8 1
5 224372
8 1
9 4
10 58
5 28
10 165
5 10
10 11
10 2
5 3632

11 rows selected.
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013

18:27:52
18:27:52
18:27:52
18:27:52
18:27:52
18:27:52
18:27:52
18:27:52
18:27:52
18:27:53
18:27:53
18:27:53
18:27:53
18:27:53
18:27:53
18:27:53
18:27:53
18:27:54

: procedure delete_instances
: time check
: sysdate = 22/MAY/2013:18/27
: stoptime = 22/MAY/2013:19/27
: checking for partitions
: done checking for partitions
: composite_dn =
: loop count = 1
: deleting non-orphaned instances
Number of rows in table ecid_purge Inserted = 1694
: perform top-level pruning
: total rows before top level pruning = 1694
Number of rows in table prune_running_insts Inserted for open composite instances 0
Number of rows in table prune_running_insts deleted for open composite instances 0
: total rows after top level pruning = 1694
: total rows before pruning 1694
: calling pruneOpenECIDs
Number of rows in table prune_running_insts Inserted (bpel)for open ci 0

22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
= 0
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013

18:27:54
18:27:54
18:27:54
18:27:54
18:27:54
18:27:54
18:27:54
18:27:54
18:27:54
18:27:54
18:27:54
18:27:54
18:27:54
18:27:57
18:35:37
18:35:37
18:35:37
18:37:44
18:38:35
18:50:15
18:50:56
18:50:56
18:50:56
19:02:35
19:15:30
19:17:40
19:18:01
19:22:00
19:22:01
19:22:01
19:25:04
19:25:05
19:25:05
19:25:05
19:25:05
19:25:06
19:25:06
19:25:06
19:25:06
19:25:06
19:25:06
19:25:07

Number of rows in table prune_running_insts Inserted (bpel) for dlv_message0


Number of rows in table ecid_purge Deleted (bpel) for dlv_message0
Number of rows in table prune_running_insts Inserted 0
Number of rows in table ecid_purge purged is : 0
Number of rows in table prune_running_insts Workflow inserts into prune table = 0
Number of rows in table ecid_purge Workflow deletes ECIDs for open WFTask = 0
Number of rows in table prune_running_insts Inserted 0
Number of rows in table ecid_purge purged is : 0
: finished pruneOpenECIDs
: total_rows_after_pruning 1694
: calling soa_orabpel.deleteComponentInstances
Number of rows in table temp_cube_instance Inserted = 224420
Number of rows in table temp_document_ci_ref Inserted = 112213
Number of rows in table temp_document_dlv_msg_ref Inserted = 224356
Number of rows in table HEADERS_PROPERTIES purged is : 224356
Number of rows in table AG_INSTANCE purged is : 0
Number of rows in table TEST_DETAILS purged is : 0
Number of rows in table CUBE_SCOPE purged is : 224362
Number of rows in table AUDIT_COUNTER purged is : 224399
Number of rows in table AUDIT_TRAIL purged is : 334639
Number of rows in table AUDIT_DETAILS purged is : 112198
Number of rows in table CI_INDEXES purged is : 0
Number of rows in table WORK_ITEM purged is : 8
Number of rows in table WI_FAULT purged is : 224359
Number of rows in table XML_DOCUMENT purged is : 224361
Number of rows in table DOCUMENT_DLV_MSG_REF purged is : 224356
Number of rows in table DOCUMENT_CI_REF purged is : 112213
Number of rows in table DLV_MESSAGE purged is : 224356
Number of rows in table DLV_SUBSCRIPTION purged is : 4
Number of rows in table DLV_AGGREGATION purged is : 0
Number of rows in table CUBE_INSTANCE purged is : 224420
Number of rows in table BPM_AUDIT_QUERY purged is : 0
Number of rows in table BPM_MEASUREMENT_ACTIONS purged is : 0
Number of rows in table BPM_MEASUREMENT_ACTION_EXCEPS purged is : 0
Number of rows in table BPM_CUBE_AUDITINSTANCE purged is : 0
Number of rows in table BPM_CUBE_TASKPERFORMANCE purged is : 0
Number of rows in table BPM_CUBE_PROCESSPERFORMANCE purged is : 0
: completed soa_orabpel.deleteComponentInstances
: calling workflow.deleteComponentInstances
: workflow.deleteComponentInstance begins
: workflow.truncate_temp_tables
Number of rows in table temp_wftask_purge workflow.deleteComponentInstance Inserted

19:25:07
19:25:07
19:25:07
19:25:07
19:25:07
19:25:07
19:25:07
19:25:07
19:25:07
19:25:07
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08

: workflow.delete_workflow_instances begins
: Purging WFTask_TL
Number of rows in table WFTask_TL Purge WFTask_TL0
: Purging WFTaskHistory
Number of rows in table WFTaskHistory Purge WFTaskHistory0
: Purging WFTaskHistory_TL
Number of rows in table WFTaskHistory_TL Purge WFTaskHistory_TL0
: Purging WFComments
Number of rows in table WFComments Purge WFComments0
: Purging WFMessageAttribute
Number of rows in table WFMessageAttribute Purge WFMessageAttribute0
: Purging WFAttachment
Number of rows in table WFAttachment Purge WFAttachment0
: Purging WFAssignee
Number of rows in table WFAssignee Purge WFAssignee0
: Purging WFReviewer
Number of rows in table WFReviewer Purge WFReviewer0
: Purging WFCollectionTarget
Number of rows in table WFCollectionTarget Purge WFCollectionTarget0
: Purging WFRoutingSlip
Number of rows in table WFRoutingSlip Purge WFRoutingSlip0
: Purging WFNotification
Number of rows in table WFNotification Purge WFNotification0

22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013
22-MAY-2013

19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:08
19:25:09
19:25:09
19:25:09
19:25:09
19:25:09
19:25:09
19:25:09
19:25:09
19:25:09
19:25:09
19:25:09
19:25:09
19:27:07
19:50:59
19:54:29
20:27:45
20:27:48
20:27:48
20:27:48
20:27:48
20:41:31
20:43:07
20:43:08
20:43:09
20:43:09
20:43:09
20:43:09
20:43:09
20:43:09
20:43:09
20:46:31
20:46:31
20:46:31
20:46:31
20:46:31

: Purging WFTaskTimer
Number of rows in table WFTaskTimer Purge WFTaskTimer0
: Purging WFTaskError
Number of rows in table WFTaskError Purge WFTaskError0
: Purging WFHeaderProps
Number of rows in table WFHeaderProps Purge WFHeaderProps0
: Purging WFEvidence
Number of rows in table WFEvidence Purge WFEvidence0
: Purging WFTaskAssignmentStatistic
Number of rows in table WFTaskAssignmentStatistic Purge WFTaskAssignmentStatistic0
: Purging WFTaskAggregation
Number of rows in table WFTaskAggregation Purge WFTaskAggregation0
: Purging WFTask
Number of rows in table WFTask Purge WFTask0
: workflow.delete_workflow_instances ends
: workflow.deleteComponentInstance ends
: completed workflow.deleteComponentInstances
: calling mediator.deleteComponentInstances
Number of rows in table temp_mediator_instance Inserted = 12
Number of rows in table mediator_payload purged is : 0
Number of rows in table mediator_deferred_message purged is : 0
Number of rows in table mediator_document purged is : 0
Number of rows in table mediator_case_detail purged is : 0
Number of rows in table mediator_case_instance purged is : 0
Number of rows in table mediator_instance purged is : 0
: completed mediator.deleteComponentInstances
: calling decision.deleteComponentInstances
Number of rows in table temp_brdecision_instance Inserted = 0
Number of rows in table BRDecisionFault purged is : 0
Number of rows in table BRDecisionUnitOfWork purged is : 0
Number of rows in table BRDecisonInstance purged is : 0
: completed decision.deleteComponentInstances
: calling fabric.deleteComponentInstances
Number of rows in table reference_instance_purge inserted = 736122
Number of rows in table xml_document purged is : 736080
Number of rows in table instance_payload purged is : 736139
Number of rows in table reference_instance purged is : 736122
Number of rows in table xml_document purged is : 0
Number of rows in table rejected_msg_native_payload purged is : 0
Number of rows in table instance_payload purged is : 0
Number of rows in table composite_instance_fault purged is : 39
Number of rows in table xml_document purged is : 224407
Number of rows in table instance_payload purged is : 224407
Number of rows in table composite_sensor_value purged is : 0
Number of rows in table composite_instance_assoc purged is : 0
Number of rows in table component_instance_purge inserted = 0
Number of rows in table xml_document purged is : 0
Number of rows in table instance_payload purged is : 0
Number of rows in table component_instance purged is : 0
Number of rows in table attachment purged is : 0
Number of rows in table attachment_ref purged is : 0
Number of rows in table composite_instance purged is : 226023
: completed fabric.deleteComponentInstances
: time check
: sysdate = 22/MAY/2013:20/46
: stoptime = 22/MAY/2013:19/27

22-MAY-2013 20:46:32 : delete_instances completed successfully

PL/SQL procedure successfully completed.


TO_CHAR STATE COUNT(*)
------- ---------- ---------01-2013 8 1

03-2013
03-2013
04-2013
04-2013
05-2013
05-2013
11-2012

5 11
9 4
5 28
10 165
5 10
10 11
10 1

12-2012 5 3632
9 rows selected.
Procedure altered.
Procedure altered.
SQL>

#This is to show the current size of the tablespace.


sqlplus / as sysdba

You might also like