首页 > 数据库 > Oracle > Oracle查看sql_id 的历史执行计划
可以通过以下三个视图查看历史执行计划:
DBA_HIST_SQL_PLAN
DBA_HIST_SQLSTAT
DBA_HIST_SNAPSHOT
通过以下sql 能查出对应sql_id 的历史执行计划及变化时间:
select distinct SQL_ID,
PLAN_HASH_VALUE,
to_char(TIMESTAMP, 'yyyymmdd hh24:mi:ss') TIMESTAMP
from dba_hist_sql_plan
where SQL_ID = '7wh3566763q49'
order by TIMESTAMP;
通过以下sql 能查出执行计划哪些地方出现了变化:
col options for a15
col operation for a20
col object_name for a20
select distinct SQL_ID,
PLAN_HASH_VALUE,
to_char(TIMESTAMP, 'yyyymmdd hh24:mi:ss') TIMESTAMP
from dba_hist_sql_plan
where SQL_ID = '7wh3566763q49'
order by TIMESTAMP;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/21374452/viewspace-2780107/ ,如需转载,请注明出处,否则将追究法律责任。