解决 'PLAN_TABLE' is old version
分析sql执行计划的时候经常遇到
'PLAN_TABLE' is old version
原因,曾经使用toad的执行计划分析,所以执行了它自带的脚本生成的plan_table
解决方式:重新创建plan_table.
SQL> explain plan for select * from scott.emp;
已解释。
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------
---------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
---------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 87 | 2 (0)|
| 1 | TABLE ACCESS FULL| EMP | 1 | 87 | 2 (0)|
---------------------------------------------------------------
Note
-----
- 'PLAN_TABLE' is old version
SQL> drop table PLAN_TABLE;
表已删除。
SQL> @?/rdbms/admin/utlxplan
表已创建。
SQL> explain plan for select * from scott.emp;
已解释。
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------
Plan hash value: 3956160932
------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 87 | 2 (0)| 00:00:01 |
| 1 | TABLE ACCESS FULL| EMP| 1 | 87 | 2 (0)| 00:00:01 |
------------------------------------------------------------------------
已选择8行。
ok了