查看历史执行计划_ITPUB博客
如果当前执行计划仍然保存在library cache,则可以从v$sql_plan中看到。
点击(此处)折叠或打开
- SELECT plan_hash_value,
- TO_CHAR(RAWTOHEX(child_address)),
TO_NUMBER(child_number),
id,
LPAD(' ', DEPTH) || operation operation,
options,
object_owner,
object_name,
optimizer,
cost,
access_predicates,
filter_predicates
FROM V$SQL_PLAN
where sql_id = 'abcd'
ORDER BY 1, 3, 2, 4
如果执行计划已经不在library cache中了,则需要去DBA_HIST_SQL_PLAN中寻找。
点击(此处)折叠或打开
- set linesize 500
-
set pagesize 500
col plan_hash_value format 9999999999
col id format 999999
col operation format a30
col options format a15
col object_owner format a15
col object_name format a20
col optimizer format a15
col cost format 9999999999
col access_predicates format a15
col filter_predicates format a15SELECT plan_hash_value,
id,
LPAD (' ', DEPTH) || operation operation,
options,
object_owner,
object_name,
optimizer,
cost,
access_predicates,
filter_predicates
FROM dba_hist_sql_plan
WHERE sql_id = 'fahv8x6ngrb50'
ORDER BY plan_hash_value, id;