ORACLE中plan_table的作用是什么
ORACLE中plan_table的作用是什么
最近在维护一个项目,在用数据结构文档中的表和ORACLE中的表进行比较,发现数据库中多了一个plan_table表;
请问下plan_table表作用是干什么的?
-- 用于查看执行计划的
-- 创建此表的代码脚本在: SQL> @$ORACLE_HOME/rdbms/admin/utlxplan.sql
PLAN_TABLE is the default table for results of the EXPLAIN PLAN statement. It is created by utlxplan.sql, and it contains one row for each step in the execution plan. 毕业论文
-- Orace 启用自动跟踪: -- 从ORACLE9i SG第一版上看到打开自动跟踪需要运行两个脚本,如下 SQL>connect /as sysdba SQL> @$ORACLE_HOME/rdbms/admin/utlxplan.sql SQL> create public synonym plan_table for plan_table; SQL> grant all on plan_table to public; SQL> connect /as sysdba SQL> @$ORACLE_HOME/sqlplus/admin/plustrce.sql SQL> grant plustrace to public; utlxplan.sql 执行成功,但发现plustrce.sql 找不到,于是到此目录下寻找,还是没有。plustrce的目的是建立plustrace角色,那么plustrace到底有没有呢?查找dba_role_privs,发现没有plustrace角色。 但此时用SYSDBA是可以打开跟踪的,但用我的用户wwm 确无法打开跟踪。提示 SQL> set autotrace onSP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled SP2-0611: Error enabling STATISTICS report 初步判断,因为SYSDBA可以打开,但其他用户无法打开,是权限问题,于是查找资料。用以下语句解决 SQL> connect sys/pass@xxx as sysdba Connected. SQL> create role wwmtrace; Role created. SQL> grant select on v_$sesstat to wwmtrace; Grant succeeded. SQL> grant select on v_$statname to wwmtrace; Grant succeeded. SQL> grant select on v_$mystat to wwmtrace; Grant succeeded. SQL> grant wwmtrace to wwm; SQL> connect wwm/pass Connected. SQL> set autotrace onSQL> 无错误提示,测试正确
执行计划就是sql执行的计划,记录了sql执行的路径,是否使用索引等等.