Explain plan for last executed statement

define plan_table=PLAN_TABLE
set linesize 132 pagesize 1000 feedback off verify off
column statement_id new_value statement_id
column prev_sql_addr new_value sql_addr
select prev_sql_addr||'/'||prev_child_number statement_id,prev_sql_addr,prev_hash_value,prev_sql_id
from v$session join v$mystat using(sid) where rownum=1;
delete from &PLAN_TABLE where plan_id=-1;
insert into &PLAN_TABLE select
  '&statement_id' STATEMENT_ID,
  -1 PLAN_ID,
  TIMESTAMP,REMARKS,OPERATION,OPTIONS,OBJECT_NODE,OBJECT_OWNER,OBJECT_NAME,OBJECT_ALIAS
  ,null OBJECT_INSTANCE,OBJECT_TYPE,OPTIMIZER,SEARCH_COLUMNS,ID,PARENT_ID,DEPTH,POSITION,
  COST,CARDINALITY,BYTES,OTHER_TAG,PARTITION_START,PARTITION_STOP,PARTITION_ID,OTHER,OTHER_XML,
  DISTRIBUTION,CPU_COST,IO_COST,TEMP_SPACE,ACCESS_PREDICATES,FILTER_PREDICATES,PROJECTION,TIME,
  QBLOCK_NAME from v$sql_plan where address||'/'||child_number='&statement_id';
select sql_text from v$sqltext_with_newlines where address='&sql_addr' order by piece;
select * from table(dbms_xplan.display('&PLAN_TABLE','&statement_id'));
set feedback on verify on 
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值