Oracle
嘗試擷取執行計劃時遇到錯誤“無法獲取 SQL_ID 的計劃”
我正在嘗試擷取
execution plan
我的查詢,PL/SQL developer
如下所示:select * from vmi_dimcustomer t1 inner join vmi_factcustomer t2 on t1.customer_num = t2.customer_num ; Select plan_table_output from table(dbms_xplan.display_cursor(null,null,'basic'));
但我收到了這張紙條:
SQL_ID 9m7787camwh4m, child number 0 begin :id := sys.dbms_transaction.local_transaction_id; end; NOTE: cannot fetch plan for SQL_ID: 9m7787camwh4m, 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)
我在這裡做錯了什麼?我在這裡搜尋,我得到的答案是
"set serveroutput off"
。把我不能在 PL/SQL 開發人員上做到這一點。提前致謝。
PL/SQL Developer 在後台隱式執行附加語句。
dbms_xplan.display_cursor(null,null,'basic')
從先前執行的語句返回資訊。它是begin :id := sys.dbms_transaction.local_transaction_id; end;
。執行 SQL 後,在 中找到它
V$SQL
,例如:select sql_id, child_number, sql_text from v$sql where sql_text like '%inner join vmi_factcustomer t2%';
找到 SQL 後,使用上面的資訊:
Select plan_table_output from table(dbms_xplan.display_cursor( 'sql_id from above', 'child_number from above', 'basic'));