--确认执行计划是否发生变化
select distinct a.snap_id,
a.sql_id,
a.plan_hash_value,
to_char(b.begin_interval_time, 'yyyy-mm-dd hh24:mi:ss')
from dba_hist_sqlstat a, dba_hist_snapshot b
where sql_id = '&sqlid'
and a.snap_id = b.snap_id
order by snap_id ;
--固定执行计划
DECLARE
my_plans PLS_INTEGER;
BEGIN
my_plans:=DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE(SQL_ID=>'5n791pc3vxv5t',PLAN_HASH_VALUE=>4211606665,FIXED=>'YES',ENABLED=>'YES');
END;
/