今天做SQL执行计划测试的时候,发现sqlplus无法正常打印执行计划,根据网上资料整理如下:
.....
SYS@orcl> select *
2 from table(
3dbms_xplan.display_cursor( format=> 'allstats last' )
4)
5 /
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------
SQL_ID 9babjv8yq8ru3, child number 0
BEGINDBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;
NOTE:cannot fetch plan for SQL_ID: 9babjv8yq8ru3, CHILD_NUMBER: 0
Please verify value of SQL_ID and CHILD_NUMBER;
It could also be that the plan is no longer in cursor cache (check v$sql
_plan)
注意: 标红的SQL_ID确实不存在,原因是SQLPLUS打开了SERVEROUTPUT,TOM的解释如下:
-------------------------------
Dylan Presents.
如果觉得《ORACLE cannot fetch plan for SQL_ID》对你有帮助,请点赞、收藏,并留下你的观点哦!