Autotrace是sqlplus的一个工具,用来显示所执行查询的查询计划

设置步骤

• cd [ORACLE_HOME]/rdbms/admin
• log into SQL*Plus as SYSTEM
• run @utlxplan
• run CREATE PUBLIC SYNONYM PLAN_TABLE FOR PLAN_TABLE;
• run GRANT ALL ON PLAN_TABLE TO PUBLIC;

 

创建PLUSTRACE角色

cd [ORACLE_HOME]/sqlplus/admin
• log into SQL*Plus as SYS or AS SYSDBA
• run @plustrce
• run GRANT PLUSTRACE TO PUBLIC;

 

控制查询计划报告

  • SET AUTOTRACE OFF
  • SET AUTOTRACE ON EXPLAIN
  • SET AUTOTRACE ON STATISTICS
  • SET AUTOTRACE ON
  • SET AUTOTRACE TRACEONLY

这里没有写出以上命令的区别,自己记忆一下。