您好,登錄后才能下訂單哦!
這篇文章主要講解了“分析SQL中parameter table management問題”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“分析SQL中parameter table management問題”吧!
1.查詢要執行的SQL,是否有子游標,沒有子游標
SYS@honor > select sql_id,child_number,sql_text from v$sql where sql_text like '%SELECT count(*) FROM t%'; SQL_ID CHILD_NUMBER SQL_TEXT ------------- ------------ -------------------------------------------------------------------------------- gxfdy6zpjvmtc 0 select sql_id,child_number,sql_text from v$sql where sql_text like '%SELECT coun
2.查詢當前會話sid,session1執行相關存儲過程
session1 > select * from v$mystat where statistic#=0; SID STATISTIC# VALUE ---------------------------------------- ---------------------------------------- ---------------------------------------- 49 0 0 session1 > DECLARE 2 a number; 3 v varchar2(20):='haha'; 4 BEGIN 5 FOR c IN 1..100000 6 LOOP 7 EXECUTE IMMEDIATE 'ALTER SESSION SET optimizer_index_cost_adj = 1'; EXECUTE IMMEDIATE 'SELECT count(*) FROM t' into a; 9 END LOOP; 10 END; 11 / PL/SQL procedure successfully completed.
2.查詢當前會話sid,session2執行相關存儲過程
session2 > select * from v$mystat where statistic#=0; SID STATISTIC# VALUE ---------------------------------------- ---------------------------------------- ---------- 58 0 ########## session2 > DECLARE 2 a number; 3 v varchar2(20):='haha'; 4 BEGIN 5 FOR c IN 1..100000 6 LOOP 7 EXECUTE IMMEDIATE 'ALTER SESSION SET optimizer_index_cost_adj = 2'; EXECUTE IMMEDIATE 'SELECT count(*) FROM t' into a; 9 END LOOP; 10 END; 11 / PL/SQL procedure successfully completed.
3.查詢查詢SQL子游標,發現有兩個子游標
SYS@honor > select sql_id,child_number,sql_text from v$sql where sql_text like '%SELECT count(*) FROM t%'; SQL_ID CHILD_NUMBER SQL_TEXT ------------- ------------ -------------------------------------------------------------------------------- 5nbjnx26pn4rh 0 DECLARE a number; BEGIN FOR c IN 1..100000 LOOP EXECUTE IMMEDIAT 5tjqf7sx5dzmj 0 SELECT count(*) FROM t 5tjqf7sx5dzmj 1 SELECT count(*) FROM t f14srtthcadyq 0 DECLARE a number; v varchar2(20):='haha'; BEGIN FOR c IN 1..100000 L gxfdy6zpjvmtc 0 select sql_id,child_number,sql_text from v$sql where sql_text like '%SELECT coun
4.查詢會話執行期間,等待事件,根據原理,兩個存儲過程執行過程中,會引發select語句子游標持有父游標的指向子游標的handle導致的cursor pin S wait on x爭用,但是意外發現發生了latch free,經過查詢latch類型,為parameter table management,并沒有見過相關latch,去查Mos,發現命中bug,在12.2中修復,或者打補丁
SYS@honor1 > select sid,USERNAME,EVENT,sql_id,SQL_CHILD_NUMBER,p1,p2,p3,WAIT_CLASS,WAIT_TIME,BLOCKING_SESSION,BLOCKING_SESSION_STATUS from v$session where sid in ('49','58'); SID USERNAME EVENT SQL_ID SQL_CHILD_NUMBER P1 P2 P3 WAIT_CLASS WAIT_TIME BLOCKING_SESSION BLOCKING_SESSION_STATUS ---------- ----------- ------------------- ------------- ---------------- ---------- ---------- ---------- ----------- ---------- ---------------- ----------------------- 49 LIBAI latch free 5nbjnx26pn4rh 0 1610665040 24 0 Other -1 NOT IN WAIT 58 LIBAI latch free 5tjqf7sx5dzmj 1 1610665040 24 0 Other -1 NOT IN WAIT SYS@honor1 > select to_char('1610665040','xxxxxxxxxxxx') from dual; TO_CHAR('1610 ------------- 6000cc50 SYS@honor1 > select addr,latch#,hash,name from v$latch where addr like '%6000CC50%'; ADDR LATCH# HASH NAME ---------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- 000000006000CC50 24 722869772 parameter table management
5.bug說明:
Session Waiting on 'Parameter Table Management' Latch (Doc ID 2271591.1) |
|
感謝各位的閱讀,以上就是“分析SQL中parameter table management問題”的內容了,經過本文的學習后,相信大家對分析SQL中parameter table management問題這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。