很多時候
先在sys用戶下運行@/ORACLE_HOME/sqlplus/admin/plustrce
內容
set echo on
drop role plustrace;
create role plustrace;
grant select on v_$sesstat to plustrace;
grant select on v_$statname to plustrace;
grant select on v_$session to plustrace;
grant plustrace to dba with admin option;
set echo off
產生plustrace角色
SQL> grant plustrace to &username;
然後找到/ORACLE_HOME/rdbms/admin/utlxplan
create table PLAN_TABLE (
statement_id varchar
timestamp date
remarks varchar
operation varchar
options varchar
object_node varchar
object_owner varchar
object_name varchar
object_instance numeric
object_type varchar
optimizer varchar
search_columns number
id numeric
parent_id numeric
position numeric
cost numeric
cardinality numeric
bytes numeric
other_tag varchar
partition_start varchar
partition_stop varchar
partition_id numeric
other long
distribution varchar
在SQL/PLUS的窗口運行以下命令
set time on; (說明
set autotrace on; (說明
set autotrace traceonly; (說明
接下來你就運行測試SQL語句
關閉以上功能
set time off; (說明
set autotrace off; (說明
From:http://tw.wingwit.com/Article/program/Oracle/201311/18072.html