You are on page 1of 4

SOA INFRA usefull everyday queries

First of all, if you have not allready read the following links, this is the way to start
Take a look:
https://forums.oracle.com/forums/thread.jspa?threadID=962459
The next blog holds all the information about the states and their meaning:
https://blogs.oracle.com/ateamsoab2b/entry/list_of_all_states_from
So, once you have read the above, you can easily understand the rest:
* Find running instances of a single composite
SELECT * FROM COMPOSITE_INSTANCE WHERE COMPOSITE_NAME='COMPOSITE_NAME' AND
LIVE_INSTANCES>0

* Count Instances that have run for a specific composite in a single period
select count(*) from CUBE_INSTANCE
where COMPOSITE_NAME='COMPOSITE_NAME'
and CREATION_DATE BETWEEN TO_DATE('21/09/2012 00:00:01','dd/mm/yyyy
HH24:MI:SS') AND TO_DATE('21/09/2012 10:50:00','dd/mm/yyyy HH24:MI:SS' )

* Count All Instances by state in human readable format.


SELECT (CASE WHEN STATE=1 THEN 'OPEN AND RUNNING'
WHEN STATE=2 THEN 'OPEN AND SUSPENDED'
WHEN STATE=3 THEN 'OPEN AND FAULTED'
WHEN STATE=4 THEN 'CLOSED AND PENDING'
WHEN STATE=5 THEN 'CLOSED AND COMPLETED'
WHEN STATE=6 THEN 'CLOSED AND FAUTED'
wHEN STATE=7 THEN 'CLOSED AND CANCELLED'
WHEN STATE=8 THEN 'CLOSED AND ABORTED'
WHEN STATE=9 THEN 'CLOSED AND STALE'
WHEN STATE=10 THEN 'NON-RECOVERABLE'
ELSE STATE ||
END) AS STATE, COUNT(*) AS NUM_OF_CUBE_INST FROM CUBE_INSTANCE GROUP BY STATE

* Count All Instances by state in human readable format, group by composite.


SELECT (CASE
WHEN STATE=1
WHEN STATE=2
WHEN STATE=3
WHEN STATE=4
WHEN STATE=5
WHEN STATE=6
WHEN STATE=7
WHEN STATE=8
WHEN STATE=9

THEN
THEN
THEN
THEN
THEN
THEN
THEN
THEN
THEN

'OPEN AND RUNNING'


'OPEN AND SUSPENDED'
'OPEN AND FAULTED'
'CLOSED AND PENDING'
'CLOSED AND COMPLETED'
'CLOSED AND FAUTED'
'CLOSED AND CANCELLED'
'CLOSED AND ABORTED'
'CLOSED AND STALE'

WHEN STATE=10 THEN 'NON-RECOVERABLE'


ELSE STATE || END)
AS STATE,COMPOSITE_NAME, COUNT(*) AS NUM_OF_CUBE_INST FROM CUBE_INSTANCE GROUP
BY STATE,COMPOSITE_NAME

* Count all orchestration processes that comes from mediator


select SOURCE_NAME,count(*) from COMPOSITE_INSTANCE
where PARENT_ID like 'mediator%' and
CREATED_TIME between TO_DATE('2012-11-27 08:00:00', 'YYYY-MM-DD HH24:Mi:SS')
and TO_DATE('2012-11-27 18:00:00', 'YYYY-MM-DD HH24:Mi:SS')
group by SOURCE_NAME

* Query to find the execution time of BPEL instances


SELECT * FROM (
SELECT COMPOSITE_NAME COMPOSITENAME,A.CMPST_ID
COMPOSITE_INSTANCE_ID,creation_date BEGIN_TIME,modify_date END_TIME ,
(extract(day from modify_date - creation_date)*86400+ extract(hour from
modify_date - creation_date)*3600+ extract(minute from modify_date creation_date)*60+ extract(second from modify_date - creation_date))
duration_in_second,A.* FROM cube_instance A where state = 5 and CREATION_date
BETWEEN TO_DATE('20/09/2012 00:00:00','dd/mm/yyyy HH24:MI:SS')AND
TO_DATE('20/09/2012 23:59:59','dd/mm/yyyy HH24:MI:SS')
AND COMPOSITE_NAME IN (COMPOSITE_NAME))
ORDER BY COMPOSITE_NAME,duration_in_second DESC

* Query to find the execution time of BPEL instances Extend your search query to find
the parent that has initialized the composite(very usefull!)
SELECT
qu.row_id,qu.ID,qu.composite_id,cu.STATUS,qu.created,qu.duration_in_second
FROM CUBE_INSTANCE cu,
(
select cmpinst.TITLE as row_id,cube.CIKEY as ID,cube.CMPST_ID as
composite_id,cube.CREATION_DATE as created,(extract(day from cube.modify_date
- cube.creation_date)*86400+extract(hour from cube.modify_date cube.creation_date)*3600+extract(minute from cube.modify_date cube.creation_date)*60+extract(second from cube.modify_date cube.creation_date)) duration_in_second
from CUBE_INSTANCE cube,COMPOSITE_INSTANCE cmpinst where
cube.CMPST_ID=cmpinst.ID AND
cube.COMPOSITE_NAME='COMPOSITE_NAME' and
cube.COMPONENT_NAME='COMPONENT_NAME' AND
cube.STATE>4 AND
cube.CREATION_DATE between TO_DATE('2012-10-09 14:00:00', 'YYYY-MM-DD
HH24:Mi:SS') and TO_DATE('2012-10-09 15:00:00', 'YYYY-MM-DD HH24:Mi:SS')
) qu
where
cu.CMPST_ID=qu.composite_id AND
cu.PARENT_ID=concat('bpel:',qu.ID)

* Query to find the execution time of BPEL instances from VIEW TABLES
select avg(EVAL_TIME) from BPEL_PROCESS_INSTANCES where
COMPONENT_NAME='COMPONENT_NAME' and
STATUS='STATUS' and
CREATION_DATE> TO_DATE('2014-02-27 00:00:00', 'YYYY-MM-DD HH24:Mi:SS')

* Execution time of BPEL Composite per component


select COMPONENT_NAME,avg(EVAL_TIME) from BPEL_PROCESS_INSTANCES
where
COMPOSITE_NAME='CompositeName' AND
CREATION_DATE between TO_DATE('2014-10-06 12:00:00', 'YYYY-MM-DD
HH24:Mi:SS') and TO_DATE('2014-10-06 17:00:00', 'YYYY-MM-DD HH24:Mi:SS')
group by COMPONENT_NAME

*Payload Size from Document


select document_id , DOCUMENT_TYPE,DBMS_LOB.GETLENGTH(document) a from
XML_DOCUMENT order by a DESC

Recovery console Messages


* Find callback messages
select * from dlv_message where dlv_type = 2 and (state = 0 or state = 1);

* Find invoke messages.


select * from dlv_message where dlv_type = 1 and state = 0;
exclude 5 last minutes:
select count(*) as invoke from dlv_message where dlv_type = 1 and state = 0 and
RECEIVE_DATE < sysdate - 5/1400

* Callback resolved:
select count(*) from dlv_message where dlv_type = 2 and state=2

* Undelivered receive activity


select count(*) from dlv_message where dlv_type = 2 and state=1

* Undeliverd Callback:
select count(*) from dlv_message where dlv_type = 2 and state=0

* Find recoverable activities:

select * from work_item where state = 1 and execution_type != 1;

* Find sensors:
select * from COMPOSITE_SENSOR_VALUE where SENSOR_NAME='OrchestrationId_Sensor'
and STRING_VALUE in ('1-1K8BNZL')

* Fault Framework,Find process from Title


select co.TITLE,co.COMPOSITE_DN from COMPOSITE_INSTANCE_FAULT
f,COMPOSITE_INSTANCE co WHERE
f.COMPOSITE_INSTANCE_ID=co.ID and
f.COMPOSITE_DN='COMPOSITE_DN' and
f.CREATED_TIME> TO_DATE('2013-01-08 08:00:00', 'YYYY-MM-DD HH24:Mi:SS')

* Fault Framework If the composite you are looking for has not TITLE then you can
search by distinct ECID
select distinct(co.TITLE) from COMPOSITE_INSTANCE_FAULT f,COMPOSITE_INSTANCE
co WHERE
f.ECID=co.ECID and
f.COMPOSITE_DN='COMPOSITE_DN' and
f.CREATED_TIME> TO_DATE('2013-01-08 08:00:00', 'YYYY-MM-DD HH24:Mi:SS')

* TIME OUTS
select EXP_DATE from WORK_ITEM

where CIKEY=237468638

* Find time outs that did not fire up


select * from WORK_ITEM where
CREATION_DATE between TO_DATE('2013-11-06 16:00:00', 'YYYY-MM-DD HH24:Mi:SS')
and TO_DATE('2013-11-06 17:00:00', 'YYYY-MM-DD HH24:Mi:SS') and
state=3 and
exp_date is not null

* Where is Correlation Id stored in soa-infra tables


select PROPERTIES FROM DLV_SUBSCRIPTION where CIKEY=14006267

You might also like