Look, here is code from db server directly :
16:44:55 SQL>@sql_id 1 2s5u5h47q8978
SQL_FULLTEXT
select count(*) into :b0:b1 from CTN_STOCK CTN ,NUMBER_GROUP NGP ,NM_LOGICAL_HLR LHLR ,NM_PHYSICAL_HLR PHLR where ((((((((((((:b2=(-1) or CTN.CTN_ST
ATUS=:b3) and (:b4=(-1) or (LENGTH(RTRIM(CTN.CTN))=LENGTH(RTRIM(:b5)) and CTN.CTN>=:b5))) and (:b7=(-1) or (LENGTH(RTRIM(CTN.CTN))=LENGTH(RTRIM(:b8))
and CTN.CTN<=:b8))) and (:b10=(-1) or CTN.NGP=:b11)) and CTN.NL=:b12) and ((:b13=(-1) or (:b14=‘Y’ and CTN.PAIRED_RESOURCE is not null )) or (:b14='N
’ and CTN.PAIRED_RESOURCE is null ))) and CTN.NGP=NGP.NGP_ID) and NGP.LOGICAL_HLR=LHLR.LOGICAL_HLR) and LHLR.PHYSICAL_HLR=PHLR.PHYSICAL_HLR) and (:b16
=(-1) or PHLR.PRODUCT_TYPE=:b17)) and (:b18=(-1) or LHLR.LOGICAL_HLR=:b19)) and (:b20=(-1) or LHLR.PHYSICAL_HLR=:b21))
Currently run that sql
no rows selected
IID CHILD_NR PLAN_HASH_VALUE ROWS EXECS ELA_SECS AVG_EXEC FIRST_LOAD LAST_LOAD LAST_ACTIVE USER_IO_WAIT CPU_TIME BUFFER_GETS BUFF_EXEC BA BS
1 1 2083789168 4 4 10.184875 2.54622 01-26/12:58:34 01-26/16:26:37 26 16:29:52 .16752 .936 2835840 708960 N N
Where sql_id is a script with content where first result SQL_FULLTEXT is retrieved as:
select
sql_fulltext
from
gv$sql
where
inst_id=&&1 AND
sql_id =’&&2’
and rownum<=1
;
and second result set is retrieved from:
SELECT inst_id iid,
CHILD_NUMBER,
plan_hash_value,
rows_processed,
EXECUTIONS,
ELAPSED_TIME/1000000 ELAPSED_TIME,
case when nvl(EXECUTIONS,0)=0 then -1 else ELAPSED_TIME/EXECUTIONS/1000000 end AVG_EXEC,
SUBSTR(FIRST_LOAD_TIME,6,99)FIRST_LOAD,
SUBSTR(LAST_LOAD_TIME,6,99)LAST_LOAD,
to_char (LAST_ACTIVE_TIME, ‘dd hh24:mi:ss’) LAST_ACTIVE,
user_io_wait_time/1000000 USER_IO_WAIT_TIME, CPU_TIME/10000000 CPU_TIME,
BUFFER_GETS,
case when nvl(EXECUTIONS,0)=0 then -1 else BUFFER_GETS/EXECUTIONS end BUFF_EXEC,
IS_BIND_AWARE, IS_BIND_SENSITIVE
FROM GV$SQL
WHERE INST_ID = &&1
and SQL_ID = ‘&&2’
order by iid, CHILD_NUMBER;
and this code works as hell for ages.