Estos 2 scripts ayudan a detectar los eventos en espera PASO1 y despues con el valor HASH de dicho evento obtendremos el plan de ejecucion esto para cuando no tenemos disponible el ORACLE GRID.
PASO 1. Script para detector los eventos de espera:
select count(1), s.sql_hash_value, sw.event
from v$session s, v$session_wait sw
where s.sid=sw.sid and sw.event!='SQL*Net message from client'
group by s.sql_hash_value,sw.event
order by 3 desc;
PASO 2. A través del SQL_HASH_VALUE se puede obtener el plan de ejecución
select * from table(dbms_xplan.display_cursor(1424292821));
EJEMPLO
PASO1 Ejecutar el primer query.
COUNT(1) SQL_HASH_VALUE EVENT
1 4208348705 db file sequential read
1 1046569919 db file scattered read
1 0 db file parallel write
1 0 Streams AQ: waiting for messages in the queue
PASO 2. Usar el valor hash en el Segundo query
select * from table(dbms_xplan.display_cursor(4208348705));
PLAN_TABLE_OUTPUT
HASH_VALUE 4208348705, child number 0
--------------------------------------
SELECT /*+FIRST_ROWS*/ a.t$oorg FROM baandb.twhinh200451 a WHERE a.t$sfit = :1
Plan hash value: 1523578419
--------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 14506 (100)| |
|* 1 | INDEX FULL SCAN | TWHINH200451$IDX5 | 1 | 51 | 14506 (4)| 00:02:55 |
--------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("A"."T$SFIT"=:1)
filter("A"."T$SFIT"=:1)





