[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變數
- 如何用FGA得到繫結變數的值變數
- [20200326]繫結變數抓取與NULL值.txt變數Null
- [20211227]抽取跟蹤檔案中的繫結變數值.txt變數
- 在繫結變數下使用outline變數
- MySQL高階特性——繫結變數MySql變數
- [20180930]in list與繫結變數.txt變數
- [20180912]PLSLQ與繫結變數.txt變數
- Vue select 繫結動態變數Vue變數
- [20180930]in list與繫結變數個數.txt變數
- [20210120]in list與繫結變數個數.txt變數
- BCG:AI的價值在哪裡AI
- 列印出ckpt裡的所有變數和值變數
- 【ORACLE】Oracle繫結變數知識梳理Oracle變數
- 繫結變數窺視測試案例變數
- 作為IT,你的價值在哪裡?
- [20221103]繫結變數的分配長度11.txt變數
- [20221030]繫結變數的分配長度10.txt變數
- 如何在對in操作使用變數繫結(轉)變數
- [20220414]toad與繫結變數peek.txt變數
- input,select, v-model 繫結的值為數字型別型別
- cursor_sharing=force強制繫結變數不會把變數值預設當成varchar2型別的理解變數型別
- [20240930]關於共享池-表物件在庫快取探究2.txt物件快取
- C++變數總結束 | 輸出各種變數的值C++變數
- [20191028]數值累加的各種方法2.txt
- ES6:變數的結構賦值變數賦值
- V$sql查詢未使用繫結變數的語句SQL變數
- [20231210]執行計劃與繫結變數.txt變數
- [20190506]檢視巢狀與繫結變數.txt巢狀變數
- win10怎麼配置環境變數_win10的環境變數配置在哪裡Win10變數
- Oracle中如何查詢未使用繫結變數的SQL語句?Oracle變數SQL
- Oracle資料傾斜導致的問題-無繫結變數Oracle變數
- Oracle資料傾斜導致的問題-有繫結變數Oracle變數
- 越來越發現自己不懂的還是不少--繫結變數變數
- 炒作之後,NFT的實際價值在哪裡?
- 透過v$sql_bind_capture 檢視繫結變數。SQLAPT變數
- 如何確定一個 Go 變數會被分配在哪裡?Go變數
- TensorFlow——共享變數的使用方法變數