NOTE: cannot fetch plan for SQL_ID_在plsql developer無法獲取sql執行計劃
/********在工具plsql developer*******檢視執行sql的執行計劃出錯************/
SQL> select count(a) from t_policy;
COUNT(A)
----------
100000
SQL> select * from table(dbms_xplan.display_cursor);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
SQL_ID 9m7787camwh4m, child number 4
begin :id := sys.dbms_transaction.local_transaction_id; end;
NOTE: cannot fetch plan for SQL_ID: 9m7787camwh4m, CHILD_NUMBER: 4
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_p
8 rows selected
/******檢視上述報錯的sql_id****************/
SQL> select sql_text,parse_calls,executions,version_count from v$sqlarea where sql_id='9m7787camwh4m';
SQL_TEXT PARSE_CALLS EXECUTIONS VERSION_COUNT
-------------------------------------------------------------------------------- ----------- ---------- -------------
begin :id := sys.dbms_transaction.local_transaction_id; end; 585 585 6
/******************發現報錯的sql_id是plsql developer自行封裝的plsql 程式碼塊語句,而非最上面真正執行的sql*************/
SQL> select sql_text,executions,version_count,child_number from v$sql where sql_id='9m7787camwh4m';
select sql_text,executions,version_count,child_number from v$sql where sql_id='9m7787camwh4m'
ORA-00904: "VERSION_COUNT": invalid identifier
SQL> select sql_text,executions,child_number from v$sql where sql_id='9m7787camwh4m';
SQL_TEXT EXECUTIONS CHILD_NUMBER
-------------------------------------------------------------------------------- ---------- ------------
begin :id := sys.dbms_transaction.local_transaction_id; end; 347 0
begin :id := sys.dbms_transaction.local_transaction_id; end; 87 1
begin :id := sys.dbms_transaction.local_transaction_id; end; 5 2
begin :id := sys.dbms_transaction.local_transaction_id; end; 3 3
begin :id := sys.dbms_transaction.local_transaction_id; end; 117 4
begin :id := sys.dbms_transaction.local_transaction_id; end; 30 5
6 rows selected
SQL>
/******上述同樣的sql在sqlplus中執行提取執行計劃一切正常**************/
SQL> select /*aa*/ count(a) from t_policy;
COUNT(A)
----------
100000
SQL> select * from table(dbms_xplan.display_cursor);
PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------
SQL_ID azgpcazx5tn56, child number 0
-------------------------------------
select /*aa*/ count(a) from t_policy
Plan hash value: 1176293347
-------------------------------------------------------------------------------
------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Tim
|
PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
------
| 0 | SELECT STATEMENT | | | | 66 (100)|
|
| 1 | SORT AGGREGATE | | 1 | 13 | |
|
| 2 | INDEX FAST FULL SCAN| IDX_T_POLICY | 96905 | 1230K| 66 (2)| 00:
PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------
0:01 |
-------------------------------------------------------------------------------
------
Note
-----
- dynamic sampling used for this statement (level=2)
18 rows selected.
SQL> select /*aa*/ count(a) from t_policy;
COUNT(A)
----------
100000
SQL> select * from table(dbms_xplan.display_cursor);
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------
SQL_ID azgpcazx5tn56, child number 0
-------------------------------------
select /*aa*/ count(a) from t_policy
Plan hash value: 1176293347
------------------------------------------------------------------------------
------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Ti
|
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------
------------------------------------------------------------------------------
------
| 0 | SELECT STATEMENT | | | | 66 (100)|
|
| 1 | SORT AGGREGATE | | 1 | 13 | |
|
| 2 | INDEX FAST FULL SCAN| IDX_T_POLICY | 96905 | 1230K| 66 (2)| 00
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------
0:01 |
------------------------------------------------------------------------------
------
Note
-----
- dynamic sampling used for this statement (level=2)
18 rows selected.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-757283/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 獲取SQL執行計劃SQL
- 使用 EXPLAIN PLAN 獲取SQL語句執行計劃 (R0.1)AISQL
- 【sql調優之執行計劃】獲取執行計劃SQL
- dbms_xplan.display_cursor 報錯 NOTE: cannot fetch plan for SQL_IDSQL
- Oracle 獲取SQL執行計劃方法OracleSQL
- 獲取SQL執行計劃的方式:SQL
- oracle explain plan for獲取執行計劃並不可靠.OracleAI
- 【檢視】使用V$SQL_PLAN檢視獲取曾經執行過的SQL語句執行計劃SQL
- 執行計劃-1:獲取執行計劃
- 【Explain Plan】檢視SQL的執行計劃AISQL
- 執行計劃中Note部分顯示'PLAN TABLE' is old version
- pl/sql developer 分析的執行計劃不可信SQLDeveloper
- MySQL 5.7獲取指定執行緒正在執行SQL的執行計劃資訊MySql執行緒
- Error: cannot fetch last explain plan from PLAN_TABLEErrorASTAI
- 【SQL_PLAN】Oracle 透過檢視sql_plan 格式化執行計劃SQLOracle
- 獲取執行計劃之Autotrace
- 獲取執行計劃的方法
- git fetch 無法獲取遠端分支?Git
- 獲取oracle sql語句詳細些執行計劃OracleSQL
- 【執行計劃】Oracle獲取執行計劃的幾種方法Oracle
- oracle 9i 獲取sql執行計劃(書寫長的sql)OracleSQL
- 微課sql最佳化(9)、如何獲取執行計劃SQL
- 介紹幾種獲取SQL執行計劃的方法(上)SQL
- Oracle獲取執行計劃的方法Oracle
- SQL效能的度量 - 透過v$sql_plan查詢執行計劃SQL
- 達夢資料庫獲取SQL真實的執行計劃資料庫SQL
- Oracle執行計劃Explain Plan 如何使用OracleAI
- Oracle 執行計劃(Explain Plan) 說明OracleAI
- Oracle 執行計劃(Explain Plan) 說明OracleAI
- oracle dbms_xplan獲取執行計劃Oracle
- 如何獲取真實的執行計劃
- 獲取執行計劃的6種方法
- Oracle中SQL調優(SQL TUNING)之最權威獲取SQL執行計劃大全OracleSQL
- Oracle SQL執行計劃歷史資訊表DBA_HIST_SQL_PLAN的使用OracleSQL
- zt_oracle11g sql baseline與sql execution plan執行計劃OracleSQL
- 利用statspack來獲取生成環境中top SQL及其執行計劃SQL
- sql 執行計劃SQL
- 如何清除某條SQL在庫快取中的執行計劃SQL快取