[20191216]共享池繫結變數的值在哪裡2.txt
[20191216]共享池繫結變數的值在哪裡2.txt
--//上個星期的測試,連結:http://blog.itpub.net/267265/viewspace-2668705/=>[20191213]共享池繫結變數的值在哪裡.txt
--//補充測試增加子游標的情況.
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
create table t as select rownum id ,lpad('x',100,'x') name ,lpad('1',1) flag from dual connect by level<=1e5;
2.測試:
--//session 1:
SCOTT@book> variable v_name varchar2(100)
SCOTT@book> exec :v_name :='987654321'
PL/SQL procedure successfully completed.
select * from t where name = :v_name;
select * from t where name = :v_name;
select * from t where name = :v_name;
select * from t where name = :v_name;
select * from t where name = :v_name;
select * from t where name = :v_name;
--//執行多次,獲取sql_id=2tftcf9su9k3b.
3.觀察:
--//session 2:
SYS@book> @ sharepool/shp4 2tftcf9su9k3b 0
TEXT KGLHDADR KGLHDPAR C40 KGLHDLMD KGLHDPMD KGLHDIVC KGLOBHD0 KGLOBHD6 KGLOBHS0 KGLOBHS6 KGLOBT16 N0_6_16 N20 KGLNAHSH KGLOBT03 KGLOBT09
-------------- ---------------- ---------------- ---------------------------------------- ---------- ---------- ---------- ---------------- ---------------- ---------- ---------- ---------- --------- ---------- ---------- ------------- ----------
子游標控制程式碼地址 000000007BF11478 000000007BDD5330 select * from t where name = :v_name 1 0 0 000000007C4CB808 000000007C6B1F60 8600 8088 3093 19781 19781 1906624619 2tftcf9su9k3b 0
父遊標控制程式碼地址 000000007BDD5330 000000007BDD5330 select * from t where name = :v_name 1 0 0 000000007E2EC768 00 4720 0 0 4720 4720 1906624619 2tftcf9su9k3b 65535
--//猜測繫結變數值在子游標控制程式碼的堆0中.
select a.* from x$ksmsp a where a.ksmchpar=hextoraw('000000007C4CB808')
old 1: select a.* from x$ksmsp a where a.ksmchpar=hextoraw('&&1')
new 1: select a.* from x$ksmsp a where a.ksmchpar=hextoraw('000000007C4CB808')
ADDR INDX INST_ID KSMCHIDX KSMCHDUR KSMCHCOM KSMCHPTR KSMCHSIZ KSMCHCLS KSMCHTYP KSMCHPAR
---------------- ---------- ---------- ---------- ---------- ---------------- ---------------- ---------- -------- ---------- ----------------
00007FA770A14858 2762 1 1 1 KGLH0^71a4c86b 000000007E1856D0 4096 freeabl 0 000000007C4CB808
00007FA770B653F8 15931 1 1 1 KGLH0^71a4c86b 000000007C6B07F0 4096 recr 4095 000000007C4CB808
--//前面的測試已經發現繫結變數儲存在子游標堆0,僅僅第一次傳入引數才儲存在此處.建立新的子游標看看.
--//session 1:
SCOTT@book> variable v_name varchar2(2000)
SCOTT@book> exec :v_name :='zzzzbbbbbbbbbbbbbbbb987654321aaaa'
PL/SQL procedure successfully completed.
select * from t where name = :v_name;
select * from t where name = :v_name;
select * from t where name = :v_name;
select * from t where name = :v_name;
select * from t where name = :v_name;
select * from t where name = :v_name;
--//session 2:
SYS@book> @ sharepool/shp4 2tftcf9su9k3b 0
TEXT KGLHDADR KGLHDPAR C40 KGLHDLMD KGLHDPMD KGLHDIVC KGLOBHD0 KGLOBHD6 KGLOBHS0 KGLOBHS6 KGLOBT16 N0_6_16 N20 KGLNAHSH KGLOBT03 KGLOBT09
-------------- ---------------- ---------------- ---------------------------------------- ---------- ---------- ---------- ---------------- ---------------- ---------- ---------- ---------- --------- ---------- ---------- ------------- ----------
子游標控制程式碼地址 000000007BF11478 000000007BDD5330 select * from t where name = :v_name 0 0 0 000000007C4CB808 000000007C6B1F60 8600 8088 3997 20685 20685 1906624619 2tftcf9su9k3b 0
子游標控制程式碼地址 000000007CDC4870 000000007BDD5330 select * from t where name = :v_name 1 0 0 000000007D1673C0 000000007C6B23C8 8600 8088 3997 20685 20685 1906624619 2tftcf9su9k3b 1
父遊標控制程式碼地址 000000007BDD5330 000000007BDD5330 select * from t where name = :v_name 1 0 0 000000007E2EC768 00 4720 0 0 4720 4720 1906624619 2tftcf9su9k3b 65535
select a.* from x$ksmsp a where a.ksmchpar=hextoraw('000000007D1673C0')
ADDR INDX INST_ID KSMCHIDX KSMCHDUR KSMCHCOM KSMCHPTR KSMCHSIZ KSMCHCLS KSMCHTYP KSMCHPAR
---------------- ---------- ---------- ---------- ---------- ---------------- ---------------- ---------- -------- ---------- ----------------
00007F4BACD74648 968 1 1 1 KGLH0^71a4c86b 000000007EA317D8 4096 recr 4095 000000007D1673C0
00007F4BACEE46A0 12697 1 1 1 KGLH0^71a4c86b 000000007CE01268 4096 freeabl 0 000000007D1673C0
00007F4BACED17B8 13245 1 1 1 KGLH0^71a4c86b 000000007CCEAB80 4096 freeabl 0 000000007D1673C0
--//在peek 000000007EA317D8開始處看看.
SYS@book> oradebug setmypid
Statement processed.
SYS@book> oradebug peek 0x000000007EA317D8 4096 1
[07D1673C0, 07D1683C0) = 60001190 00000000 00000FE8 00000000 7D167370 00000000 7CCEAB98 00000000 7EA32198 00000000 00000000 00000000 00000000 00000000 ...
SYS@book> oradebug tracefile_name
/u01/app/oracle/diag/rdbms/book/book/trace/book_ora_54395.trc
--//檢查/u01/app/oracle/diag/rdbms/book/book/trace/book_ora_54395.trc跟蹤檔案,發現:
07EA320A0 00000000 00000000 7EA320D0 00000000 [......... .~....]
07EA320B0 00000021 00000000 00000000 00000000 [!...............]
07EA320C0 00000000 00000000 00000000 00000000 [................]
07EA320D0 7A7A7A7A 62626262 62626262 62626262 [zzzzbbbbbbbbbbbb]
07EA320E0 62626262 36373839 32333435 61616131 [bbbb987654321aaa]
07EA320F0 00000061 00000000 7CE01930 00000000 [a.......0..|....]
07EA32100 00010000 00000001 7CE012C0 00000000 [...........|....]
07EA32110 7EA32140 00000000 7CE01910 00000000 [@!.~.......|....]
07EA32120 00000000 00000000 0000000A 00000000 [................]
--//再次驗證我的判斷.
SYS@book> oradebug peek 0x000000007CE01268 4096 1
[07CE01268, 07CE02268) = 00001001 00B38F00 7CE011A0 00000000 6005A8F0 00000000 7D1673C0 00000000 7EA31808 00000000 00000F69 40B38F00 00000000 00000000 ...
SYS@book> oradebug peek 0x000000007CCEAB80 4096 1
[07CCEAB80, 07CCEBB80) = 00001001 00B38F00 7CCEAA78 00000000 6005A8F0 00000000 7D1673C0 00000000 7CE01280 00000000 00000F41 C0B38F00 00000000 00000000 ...
$ grep zzzz /u01/app/oracle/diag/rdbms/book/book/trace/book_ora_54395.trc
07EA320D0 7A7A7A7A 62626262 62626262 62626262 [zzzzbbbbbbbbbbbb]
07CE01A20 00000000 00000000 7A7A7A7A 62626262 [........zzzzbbbb]
--//檢查/u01/app/oracle/diag/rdbms/book/book/trace/book_ora_54395.trc跟蹤檔案,發現:
07CE01A20 00000000 00000000 7A7A7A7A 62626262 [........zzzzbbbb]
07CE01A30 62626262 62626262 62626262 36373839 [bbbbbbbbbbbb9876]
07CE01A40 32333435 61616131 00000061 00000000 [54321aaaa.......]
07CE01A50 00000000 00000000 00000000 00000000 [................]
Repeat 2 times
--//在0x000000007CE01268處長度4096哪裡也有.
4.附上指令碼:
$ cat shp4.sql
column N0_6_16 format 99999999
SELECT DECODE (kglhdadr,
kglhdpar, '父遊標控制程式碼地址',
'子游標控制程式碼地址')
text,
kglhdadr,
kglhdpar,
substr(kglnaobj,1,40) c40,
KGLHDLMD,
KGLHDPMD,
kglhdivc,
kglobhd0,
kglobhd6,
kglobhs0,kglobhs6,kglobt16,
kglobhs0+kglobhs6+kglobt16 N0_6_16,
kglobhs0+kglobhs1+kglobhs2+kglobhs3+kglobhs4+kglobhs5+kglobhs6+kglobt16 N20,
kglnahsh,
kglobt03 ,
kglobt09
FROM x$kglob
WHERE kglobt03 = '&1' or kglhdpar='&1' or kglhdadr='&1' or KGLNAHSH= &2;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2668709/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20191213]共享池繫結變數的值在哪裡.txt變數
- 共享池之九:繫結變數與session_cached_cursors變數Session
- 繫結變數分級導致共享池佔用過大變數
- 查詢繫結變數的值變數
- 關於繫結變數的SQL繫結什麼值變數SQL
- 獲取sql繫結變數的值SQL變數
- ORACLE 獲取繫結變數值Oracle變數
- 如何獲取繫結變數值變數
- 如何用FGA得到繫結變數的值變數
- 如何得到繫結變數的輸入值變數
- 繫結變數優缺點、使用、繫結變數窺探、 Oracle自適應共享遊標變數Oracle
- java程式裡怎麼使用繫結變數Java變數
- [20160302]繫結變數的分配長度2.txt變數
- 繫結變數變數
- 繫結變數之繫結變數窺探(Bind Peeking)變數
- Oracle 繫結變數Oracle變數
- 繫結變數的測試變數
- 繫結變數窺測的演變變數
- 在php中使用繫結變數的方法(Oracle SQL共享的機制)(轉)PHP變數OracleSQL
- 檢視繫結變數變數
- 繫結變數窺測變數
- PLSQL使用繫結變數SQL變數
- Oracle之繫結變數Oracle變數
- 關於繫結變數變數
- Oracle9i, 10g 如何抓取繫結變數的值Oracle變數
- 改變gridview繫結列值的方法View
- v$sql_bind_capture與timestamp型別的繫結變數的數值SQLAPT型別變數
- 繫結變數的一個例子變數
- 繫結變數的使用範圍變數
- oracle繫結變數的測試Oracle變數
- 關於繫結變數的使用變數
- 【優化】使用繫結變數 OR 不使用繫結變數,這不是問題!優化變數
- 通過ERRORSTACK找出正在執行的SQL中的繫結變數值ErrorSQL變數
- ORACLE 繫結變數用法總結Oracle變數
- 使用繫結變數的一點總結!變數
- 【最佳化】使用繫結變數 OR 不使用繫結變數,這不是問題!變數
- hadoop的價值在哪裡Hadoop
- Oracle 變數繫結與變數窺視合集Oracle變數