V$SQLから調査したいSQLを探し出した後、ADDRESS、HASH_VALUEやSQL_IDでV$SQL_PLANから実行計画を取得し、整形するスクリプト(小田さんのページから借用)
【パターン①】
column id format 999 newline
column operation format a20
column options format a15
column object_name format a22 trunc
column optimizer format a3 trunc
select id
, lpad (' ', depth) || operation operation
, options
, object_name
, optimizer
, cost
from v$sql_plan
where hash_value = &hash_value
and address = '&address'
start with id = 0
connect by
(prior id = parent_id
and prior hash_value = hash_value
and prior child_number = child_number
)
order siblings by id, position;
【パターン②】
column id format 999 newline
column operation format a20
column options format a15
column object_name format a22 trunc
column optimizer format a3 trunc
select id
, lpad (' ', depth) || operation operation
, options
, object_name
, optimizer
, cost
from v$sql_plan
where sql_id = &sql_id
start with id = 0
connect by (prior id = parent_id
and prior sql_id = sql_id
and prior child_number = child_number
)
order siblings by id, position;
0 件のコメント:
コメントを投稿