[Oracle]查看SQL的执行计划
程序员文章站
2022-06-04 16:46:36
...
SQL SET AUTOTRACE ON SQL SELECT SYSDATE FROM DUAL; SYSDATE -------------- 26-9月-12 执行计划 ---------------------------------------------------------- ERROR:anuncaughterror in function displayhashappened;pleasecontactOracle support Please
- SQL> SET AUTOTRACE ON
- SQL> SELECT SYSDATE FROM DUAL;
- SYSDATE
- --------------
- 26-9月 -12
- 执行计划
- ----------------------------------------------------------
- ERROR: an uncaught error in function display has happened; please contact Oracle
- support
- Please provide also a DMP file of the used plan table PLAN_TABLE
- ORA-00904: "OTHER_TAG": 标识符无效
- 统计信息
- ----------------------------------------------------------
- 0 recursive calls
- 0 db block gets
- 0 consistent gets
- 0 physical reads
- 0 redo size
- 347 bytes sent via SQL*Net to client
- 338 bytes received via SQL*Net from client
- 2 SQL*Net roundtrips to/from client
- 0 sorts (memory)
- 0 sorts (disk)
- 1 rows processed
解决方法:
Need to recreate or upgrade the plan table, it is still the 8i one.
Please drop the table and run
SQL> drop table PLAN_TABLE ;
表已删除。
SQL> @C:\oracle\product\10.2.0\client_2\RDBMS\ADMIN\utlxplan.sql
表已创建。
- SQL> SET AUTOTRACE ON
- SQL> SELECT SYSDATE FROM DUAL;
- SYSDATE
- --------------
- 26-9月 -12
- 执行计划
- ----------------------------------------------------------
- Plan hash value: 1388734953
- -----------------------------------------------------------------
- | Id | Operation | Name | Rows | Cost (%CPU)| Time |
- -----------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 1 | 2 (0)| 00:00:01 |
- | 1 | FAST DUAL | | 1 | 2 (0)| 00:00:01 |
- -----------------------------------------------------------------
- 统计信息
- ----------------------------------------------------------
- 0 recursive calls
- 0 db block gets
- 0 consistent gets
- 0 physical reads
- 0 redo size
- 347 bytes sent via SQL*Net to client
- 338 bytes received via SQL*Net from client
- 2 SQL*Net roundtrips to/from client
- 0 sorts (memory)
- 0 sorts (disk)
- 1 rows processed
- SQL>
ps:查看执行计划,也可以是使用 [Oracle]如何查看SQL的执行计划 - DBMS_XPLAN Package