三种查看方式:
1. EXPLAIN
2. AUTOTRACE;
3. PL/SQL工具
EXPLAIN:
1. 安装:
UNIX: $ORACLE_HOME/rdbms/admin\ultxplan.sql
Windows:%ORACLE_HOME%\rdbms\admin\ultxplan.sql
2. 建立:
set feedback on;
explain plan set statement_id='T_TEST' for select * from hr.employees;
explain plan set statement_id='T_TEST' for select * from hr.employees;
3. 查看:
select * from plan_table;
AUTOTRACE:
1. 安装:
UNIX: $ORACLE_HOME/rdbms/admin\ultxplan.sql
Windows:%ORACLE_HOME%\rdbms\admin\ultxplan.sql
2. 建同义词,授权:
create public synonym plan_table for plan_table;--建立同义词
grant all on plan_table to public;--授权所有用户
grant all on plan_table to public;--授权所有用户
3. 运行脚本:
UNIX:$ORACLE_HOME/sqlplus/admin/plustrce.sql;
Windows:%ORACLE_HOME%\sqlplus\admin\plustrce.sql;
grant plustrace to public;
4.使用:
查看执行计划:
set autotrace on explain
select * from hr.employees;
查看统计结果:
set autotrace on statictics;
select * from hr.employees;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24751738/viewspace-709979/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24751738/viewspace-709979/