程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> Oracle教程 >> ORACLEcannotfetchplanforSQL_ID

ORACLEcannotfetchplanforSQL_ID

編輯:Oracle教程

ORACLEcannotfetchplanforSQL_ID


今天做SQL執行計劃測試的時候,發現sqlplus無法正常打印執行計劃,根據網上資料整理如下:

.....

SYS@orcl> select *
2 from table(
3 dbms_xplan.display_cursor( format=> 'allstats last' )
4 )
5 /


PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------
SQL_ID 9babjv8yq8ru3, child number 0


BEGIN DBMS_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的解釋如下:

do you see the sql it is showing - dbms_output.get_lines....

the last sql your session executed was in fact that call - sqlplus does that when you have set serveroutput on


issue 解決方法:

set serveroutput off

and try it... 再次查詢

-------------------------------

Dylan Presents.

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved