方式一、
查询正在执行的sql
select a.program, b.spid, c.sql_text,c.SQL_ID,SQL_CHILD_NUMBER
from v\$session a, v\$process b, v\$sqlarea c
where a.paddr = b.addr
and a.sql_hash_value = c.hash_value
and a.username is not null;
--通过sqlid获取执行计划
select * from table(dbms_xplan.display_cursor('sqlid'));
方式二、
通过 explain plan
例如:
explain plan for select * from dual;
执行语句查询:
select * from table(dbms_xplan.display());
网友评论