ORACLE cannot fetch plan for SQL_ID,fetchsql_id

來源:互聯網
上載者:User

ORACLE cannot fetch plan for SQL_ID,fetchsql_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.


相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.