1,查找历史sql
select * from dba_hist_sqltext where sql_text like '%PORTAL_ORDERBILL%' and sql_text like '%PORTAL_CONSIGNEE%';
2,查找历史sql的执行计划是否发生过变化,并在何时发生变化
select a.INSTANCE_NUMBER,
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
a.snap_id = b.snap_id
and a.sql_id in(select sql_id from dba_hist_sqltext where sql_text like '%PORTAL_ORDERBILL%' and sql_text like '%PORTAL_CONSIGNEE%' )
order by a.sql_id;
3,查找发生执行计划变化的两个差异
select plan_hash_value,
id,
operation,
options,
object_name,
depth,
cost,
timestamp
from DBA_HIST_SQL_PLAN
where sql_id
in(select sql_id from dba_hist_sqltext where sql_text like '%PORTAL_ORDERBILL%' and sql_text like '%PORTAL_CONSIGNEE%' )
and plan_hash_value in (209417713, 2699309196)
order by a.sql_id;
4,出现故障的执行计划对portal_orderbill的orderbill_date列进行了降序索引,
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/15108676/viewspace-1757385/
,如需转载,请注明出处,否则将追究法律责任。