Explain plan for an Old Query :
set pages 9999 lines 300
select SESSION_ID,SESSION_SERIAL#,SQL_ID,SQL_PLAN_HASH_VALUE from DBA_HIST_ACTIVE_SESS_HISTORY where SESSION_ID=<session_id> and SESSION_SERIAL#=<session_serial>;
SELECT * FROM TABLE(dbms_xplan.display_awr('&SQL_ID'));
SELECT * FROM TABLE(dbms_xplan.display_awr('&SQL_ID','&plan_hash_value'));
select * from table(dbms_xplan.display_awr('&sql_id',null,null,'advanced +peeked_binds'));
SELECT * FROM TABLE(dbms_xplan.display_cursor('&SQL_ID'));
SELECT * FROM TABLE(dbms_xplan.display_cursor('&SQL_ID', '&child_number'));
Explain plan for Query :
alter session set current_schema=<schema_name>;
select * from table(dbms_xplan.display);
select * from table(dbms_xplan.display_cursor);
select /*+ gather_plan_statistics */ count(*) from hist_test where id1>1000000;
select * from table(dbms_xplan.display_cursor(null,null,'ALLSTATS LAST'));
select distinct sql_id, PLAN_HASH_VALUE,TIMESTAMP from dba_hist_sql_plan where sql_id='&sql_id';
set pages 9999 lines 300
select SESSION_ID,SESSION_SERIAL#,SQL_ID,SQL_PLAN_HASH_VALUE from DBA_HIST_ACTIVE_SESS_HISTORY where SESSION_ID=<session_id> and SESSION_SERIAL#=<session_serial>;
SELECT * FROM TABLE(dbms_xplan.display_awr('&SQL_ID'));
SELECT * FROM TABLE(dbms_xplan.display_awr('&SQL_ID','&plan_hash_value'));
select * from table(dbms_xplan.display_awr('&sql_id',null,null,'advanced +peeked_binds'));
SELECT * FROM TABLE(dbms_xplan.display_cursor('&SQL_ID'));
SELECT * FROM TABLE(dbms_xplan.display_cursor('&SQL_ID', '&child_number'));
Explain plan for Query :
alter session set current_schema=<schema_name>;
select * from table(dbms_xplan.display);
select * from table(dbms_xplan.display_cursor);
select /*+ gather_plan_statistics */ count(*) from hist_test where id1>1000000;
select * from table(dbms_xplan.display_cursor(null,null,'ALLSTATS LAST'));
select distinct sql_id, PLAN_HASH_VALUE,TIMESTAMP from dba_hist_sql_plan where sql_id='&sql_id';
No comments:
Post a Comment