[20200416]關於軟軟解析的問題.txt
[20200416]關於軟軟解析的問題.txt
--//別人問的問題,如果在一個會話裡面如果一條語句存在2個子游標快取,這樣v$open_cursor看到幾條.
--//透過測試說明問題:
1.環境:
SCOTT@book> @ ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
2.測試:
--//sessionn 1:
SCOTT@book> @ spid
SID SERIAL# PROCESS SERVER SPID PID P_SERIAL# C50
---------- ---------- ------------------------ --------- ------ ------- ---------- --------------------------------------------------
295 1945 39670 DEDICATED 39671 21 183 alter system kill session '295,1945' immediate;
select * from dept where deptno=10;
select * from dept where deptno=10;
select * from dept where deptno=10;
select * from dept where deptno=10;
select * from dept where deptno=10;
SCOTT@book> @ hash
HASH_VALUE SQL_ID CHILD_NUMBER HASH_HEX
---------- ------------- ------------ ---------
911274289 4xamnunv51w9j 0 3650f131
--//sql_id=4xamnunv51w9j
--//session 2:
SYS@book> column sql_text format a40
SYS@book> select * from v$open_cursor where sql_id='4xamnunv51w9j' and sid=295;
SADDR SID USER_NAME ADDRESS HASH_VALUE SQL_ID SQL_TEXT LAST_SQL_ACTIVE_TIM SQL_EXEC_ID CURSOR_TYPE
---------------- ---------- --------- ---------------- ---------- ------------- ---------------------------------------- ------------------- ----------- ---------------------
0000000085EC7D20 295 SCOTT 000000007C253FE8 911274289 4xamnunv51w9j select * from dept where deptno=10 SESSION CURSOR CACHED
--//sessionn 1:
SCOTT@book> alter session set optimizer_index_cost_adj=99;
Session altered.
select * from dept where deptno=10;
select * from dept where deptno=10;
select * from dept where deptno=10;
select * from dept where deptno=10;
select * from dept where deptno=10;
--//session 2:
SYS@book> select * from v$open_cursor where sql_id='4xamnunv51w9j' and sid=295;
SADDR SID USER_NAME ADDRESS HASH_VALUE SQL_ID SQL_TEXT LAST_SQL_ACTIVE_TIM SQL_EXEC_ID CURSOR_TYPE
---------------- ---------- --------- ---------------- ---------- ------------- ---------------------------------------- ------------------- ----------- ---------------------
0000000085EC7D20 295 SCOTT 000000007C253FE8 911274289 4xamnunv51w9j select * from dept where deptno=10 SESSION CURSOR CACHED
0000000085EC7D20 295 SCOTT 000000007C253FE8 911274289 4xamnunv51w9j select * from dept where deptno=10 SESSION CURSOR CACHED
SYS@book> select distinct * from v$open_cursor where sql_id='4xamnunv51w9j' and sid=295;
SADDR SID USER_NAME ADDRESS HASH_VALUE SQL_ID SQL_TEXT LAST_SQL_ACTIVE_TIM SQL_EXEC_ID CURSOR_TYPE
---------------- ---------- --------- ---------------- ---------- ------------- ---------------------------------------- ------------------- ----------- ---------------------
0000000085EC7D20 295 SCOTT 000000007C253FE8 911274289 4xamnunv51w9j select * from dept where deptno=10 SESSION CURSOR CACHED
--//兩行內容一樣。
SYS@book> @ tpt/sql_id 4xamnunv51w9j %
Show SQL text, child cursors and execution stats for SQLID 4xamnunv51w9j child %
HASH_VALUE CH# SQL_TEXT
---------- ---- ----------------------------------
911274289 0 select * from dept where deptno=10
911274289 1 select * from dept where deptno=10
old 24: sql_id = ('&1')
new 24: sql_id = ('4xamnunv51w9j')
old 25: and child_number like '&2'
new 25: and child_number like '%'
CH# PARENT_HANDLE OBJECT_HANDLE PLAN_HASH PARSES H_PARSES EXECUTIONS FETCHES ROWS_PROCESSED CPU_MS ELA_MS LIOS PIOS SORTS USERS_EXECUTING
---- ---------------- ---------------- ---------- ---------- ---------- ---------- ---------- -------------- ---------- ---------- ---------- ---------- ---------- ---------------
0 000000007C253FE8 000000007C252B68 2852011669 5 1 5 5 5 4.999 5.048 87 7 0 0
1 000000007C253FE8 000000007C206860 2852011669 5 1 5 5 5 1.999 2.232 10 0 0 0
--//PARENT_HANDLE對應v$open_cursor的ADDRESS。實際上v$open_cursor訪問的基表是x$kgllk。
SYS@book> @ sharepool/shp4 4xamnunv51w9j 0
old 20: WHERE kglobt03 = '&1' or kglhdpar='&1' or kglhdadr='&1' or KGLNAHSH= &2
new 20: WHERE kglobt03 = '4xamnunv51w9j' or kglhdpar='4xamnunv51w9j' or kglhdadr='4xamnunv51w9j' or KGLNAHSH= 0
TEXT KGLHDADR KGLHDPAR C40 KGLHDLMD KGLHDPMD KGLHDIVC KGLOBHD0 KGLOBHD6 KGLOBHS0 KGLOBHS6 KGLOBT16 N0_6_16 N20 KGLNAHSH KGLOBT03 KGLOBT09
--------------------- ---------------- ---------------- ---------------------------------------- ---------- ---------- ---------- ---------------- ---------------- ---------- ---------- ---------- --------- ---------- ---------- ------------- ----------
child handle address 000000007C252B68 000000007C253FE8 select * from dept where deptno=10 1 0 0 000000007C252AB0 000000007C253638 4528 12144 4347 21019 21019 911274289 4xamnunv51w9j 0
child handle address 000000007C206860 000000007C253FE8 select * from dept where deptno=10 1 0 0 000000007C202300 000000007C253C00 4528 12144 4347 21019 21019 911274289 4xamnunv51w9j 1
parent handle address 000000007C253FE8 000000007C253FE8 select * from dept where deptno=10 1 0 0 000000007C253F30 00 4720 0 0 4720 4720 911274289 4xamnunv51w9j 65535
SELECT inst_id
,kgllkuse
,kgllksnm
,user_name
,kglhdpar
,kglnahsh
,kgllksqlid
,kglnaobj
,kgllkest
,DECODE (kgllkexc, 0, TO_NUMBER (NULL), kgllkexc)
,kgllkctp
,kgllkhdl
FROM x$kgllk
WHERE kglhdnsp = 0
AND kglhdpar != kgllkhdl
AND kgllksqlid = '4xamnunv51w9j'
AND kgllksnm = 295;
INST_ID KGLLKUSE KGLLKSNM USER_NAME KGLHDPAR KGLNAHSH KGLLKSQLID KGLNAOBJ KGLLKEST DECODE(KGLLKEXC,0,TO_NUMBER(NULL),KGLLKEXC) KGLLKCTP KGLLKHDL
------- ---------------- ---------- --------- ---------------- ---------- ------------- ---------------------------------- -------- ------------------------------------------- --------------------- ----------------
1 0000000085EC7D20 295 SCOTT 000000007C253FE8 911274289 4xamnunv51w9j select * from dept where deptno=10 SESSION CURSOR CACHED 000000007C252B68
1 0000000085EC7D20 295 SCOTT 000000007C253FE8 911274289 4xamnunv51w9j select * from dept where deptno=10 SESSION CURSOR CACHED 000000007C206860
--//後面的KGLLKHDL就是子游標的地址。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2686484/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20171120]關於find 軟連線問題.txt
- 關於軟體測試的7個核心問題
- 關於GI和DATABASE軟體版本高低的問題Database
- 關於軟體測試七個核心問題
- 關於SAX解析xml檔案的問題XML
- 關於開啟軟體提示各種缺少dll問題
- 關於硬體及軟體實現條帶化的問題
- 請教banq關於自學和NIIT軟體培訓的問題
- [軟體工程]關於SEMAT方法的思考和銀彈問題的探索軟體工程
- 中介軟體相關問題整理
- ORACLE的軟 軟 軟 解析!Oracle
- 軟體開發丨關於軟體重構的靈魂四問
- 關於MAC非官方下載的軟體無法開啟的問題Mac
- ORACLE 硬解析和軟解析 軟軟解析Oracle
- Android 軟鍵盤相關問題Android
- Oracle中的遊標、硬解析、軟解析、軟軟解析、解析失敗Oracle
- [20181229]關於字串的分配問題.txt字串
- 關於quartus ii軟體中註釋亂碼問題的解決方法
- [軟體工程]軟體中的量化問題軟體工程
- 徹底弄懂oracle硬解析、軟解析、軟軟解析Oracle
- 關於中介軟體的思考
- 關於SAP CRM中介軟體系統搭建中遇到的一些問題
- 【轉】關於軟體外包企業如何建立員工歸屬感的問題
- 請教高手關於解析xml檔案的問題 急~~XML
- [20140218]關於SDO_GEORASTER的問題.txtAST
- 關於SQLServerDriver的問題SQLServer
- 關於 JavaMail 的問題JavaAI
- 關於session的問題Session
- 關於JavaScript中this的軟繫結JavaScript
- 關於防毒軟體薦防毒
- 解決軟體供應鏈安全問題需要關注哪些問題
- [20210410]關於time命令的解析.txt
- 關於軟解析(soft parse)與硬解析(hard parse),以及session cached cursors (asktom)Session
- [20161108]關於資料檔案的問題.txt
- [20171228]關於資料塊轉儲的問題.txt
- [20121108]關於克隆資料庫的問題.txt資料庫
- [20190918]關於函式索引問題.txt函式索引
- [20150304]關於sql格式化問題.txtSQL