[20210803]使用那個shared pool latch(補充).txt
[20210803]使用那個shared pool latch(補充).txt
--//前一陣子寫了http://blog.itpub.net/267265/viewspace-2780256/=>[20210708]使用那個shared pool latch.txt
--//裡面提到sql語句使用的shared pool latch.是 sql語句的hash_value % bucket_size % _kghdsidx_count +1 ,
--//我是透過例子以及gdb來驗證,有人質疑不會是巧合,當然我測試前確實是在猜測.
--//實際上可以透過一個簡單的方法驗證我的判斷是對的.
1.環境:
SYS@127.0.0.1:9014/ywdb> @ 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
SYS@127.0.0.1:9014/ywdb> @ hide _kgl_bucket_count
NAME DESCRIPTION DEFAULT_VALUE SESSION_VALUE SYSTEM_VALUE ISSES ISSYS_MOD
----------------- ------------------------------------------------------------------ ------------- ------------- ------------ ----- ---------
_kgl_bucket_count Library cache hash table bucket count (2^_kgl_bucket_count * 256) TRUE 9 9 FALSE FALSE
SYS@127.0.0.1:9014/ywdb> @ hide idx_count
NAME DESCRIPTION DEFAULT_VALUE SESSION_VALUE SYSTEM_VALUE ISSES ISSYS_MOD
--------------- ------------------ ------------- ------------- ------------ ----- ---------
_kghdsidx_count max kghdsidx count TRUE 7 7 FALSE FALSE
SYS@127.0.0.1:9014/ywdb> @ tix
New tracefile_identifier = /u01/app/oracle/diag/rdbms/ywdb/ywdb1/trace/ywdb1_ora_3733_0001.trc
SYS@127.0.0.1:9014/ywdb> oradebug setmypid
Statement processed.
SYS@127.0.0.1:9014/ywdb> oradebug dump library_cache 4;
Statement processed.
--//生產系統,轉儲有點慢...
SYS@127.0.0.1:9014/ywdb> @ tix
New tracefile_identifier = /u01/app/oracle/diag/rdbms/ywdb/ywdb1/trace/ywdb1_ora_3733_0002.trc
SYS@127.0.0.1:9014/ywdb> oradebug dump heapdump 2;
Statement processed.
# du -sm /u01/app/oracle/diag/rdbms/ywdb/ywdb1/trace/ywdb1_ora_3733_000*.trc
215 /u01/app/oracle/diag/rdbms/ywdb/ywdb1/trace/ywdb1_ora_3733_0001.trc
197 /u01/app/oracle/diag/rdbms/ywdb/ywdb1/trace/ywdb1_ora_3733_0002.trc
# egrep "HEAP DUMP|KGLH0\^|SQLA\^" /u01/app/oracle/diag/rdbms/ywdb/ywdb1/trace/ywdb1_ora_3733_0002.trc >| aa.txt
2.分析aa.txt:
--//單獨讀出 HEAP DUMP heap name="sga heap(1,0)" 與 HEAP DUMP heap name="sga heap(2,0)" 之間的內容.
--//儲存為a0.txt
# grep ds=0x a0.txt >| a1.txt
# sed '1,$s/^.*\^//;1,$s/\".*$//' a1.txt | sort | uniq >| a2.txt
*/
head -5 a2.txt
10017bdc
1003249
1003249
10210a5e
10439dee
--//編輯修改如下,注意小寫換成大寫.
# cat a2.txt | tr '[a-z]' '[A-Z]' > a3.txt
--//開頭加入ibase=16
# head -5 a3.txt
ibase=16
10017BDC % 20000 % 7 +1
1003249 % 20000 % 7 +1
1003249 % 20000 % 7 +1
10210A5E % 20000 % 7 +1
--//簡單說明一下我採用16進位制計算,131072 = 0x20000.
# cat a3.txt | bc -q | uniq -c
3197 1
--//你可以發現全部結果都是1的.說明我的判斷是正確的,其它一樣驗證.
--//補充說明:
Chunk 5f1000f70 sz= 4096 recreate "KGLH0^10210a5e " latch=(nil)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chunk 5f1001f70 sz= 4096 recreate "SQLA^347151dc " latch=(nil)
Chunk 5f1002f70 sz= 4096 freeable "SQLA^105a0126 " ds=0x59f9aa4a8
--//我發現下劃線的不再這個範圍.
--//10210a5e = 270600798
--//270600798 %131072 %7+1 = 4
--//所以我計算的實際上包含ds=0x那些行.
$ egrep "HEAP DUMP|10210a5e" /u01/app/oracle/diag/rdbms/ywdb/ywdb1/trace/ywdb1_ora_3733_0002.trc
HEAP DUMP heap name="sga heap" desc=0x60001190
HEAP DUMP heap name="sga heap(1,0)" desc=0x6005cf30
Chunk 5f1000f70 sz= 4096 recreate "KGLH0^10210a5e " latch=(nil)
Chunk 5f1000f70 sz= 4096 recreate "KGLH0^10210a5e " latch=(nil)
HEAP DUMP heap name="sga heap(2,0)" desc=0x600667f8
HEAP DUMP heap name="sga heap(3,0)" desc=0x600700c0
HEAP DUMP heap name="sga heap(4,0)" desc=0x60079988
HEAP DUMP heap name="sga heap(5,0)" desc=0x60083250
HEAP DUMP heap name="sga heap(6,0)" desc=0x6008cb18
HEAP DUMP heap name="sga heap(7,0)" desc=0x600963e0
# egrep "HEAP DUMP|347151dc" /u01/app/oracle/diag/rdbms/ywdb/ywdb1/trace/ywdb1_ora_3733_0002.trc
HEAP DUMP heap name="sga heap" desc=0x60001190
HEAP DUMP heap name="sga heap(1,0)" desc=0x6005cf30
Chunk 59ec223f0 sz= 4096 freeable "SQLA^347151dc " ds=0x61238c058
Chunk 5b877a1b0 sz= 4096 recreate "KGLH0^347151dc " latch=(nil)
Chunk 5b8f98f88 sz= 4096 freeable "SQLA^347151dc " ds=0x61238c058
Chunk 5bbb1e0b8 sz= 4096 freeable "SQLA^347151dc " ds=0x61238c058
Chunk 5d49f15f0 sz= 4096 freeable "SQLA^347151dc " ds=0x61238c058
Chunk 5d5165070 sz= 4096 freeable "SQLA^347151dc " ds=0x61238c058
Chunk 5d53da328 sz= 4096 freeable "SQLA^347151dc " ds=0x61238c058
Chunk 5d6778ba8 sz= 4096 freeable "SQLA^347151dc " ds=0x61238c058
Chunk 5f1001f70 sz= 4096 recreate "SQLA^347151dc " latch=(nil)
Chunk 5f2d78ce8 sz= 4096 freeable "KGLH0^347151dc " ds=0x5d6464cb8
Chunk 611b2da28 sz= 4096 freeable "SQLA^347151dc " ds=0x61238c058
Chunk 61238b8e0 sz= 4096 recreate "KGLH0^347151dc " latch=(nil)
Chunk 6136fbba8 sz= 4096 freeable "SQLA^347151dc " ds=0x61238c058
Chunk 613bab998 sz= 4096 freeable "SQLA^347151dc " ds=0x61238c058
Chunk 5f1001f70 sz= 4096 recreate "SQLA^347151dc " latch=(nil)
Chunk 5b877a1b0 sz= 4096 recreate "KGLH0^347151dc " latch=(nil)
HEAP DUMP heap name="sga heap(2,0)" desc=0x600667f8
HEAP DUMP heap name="sga heap(3,0)" desc=0x600700c0
HEAP DUMP heap name="sga heap(4,0)" desc=0x60079988
HEAP DUMP heap name="sga heap(5,0)" desc=0x60083250
HEAP DUMP heap name="sga heap(6,0)" desc=0x6008cb18
HEAP DUMP heap name="sga heap(7,0)" desc=0x600963e0
--//我計算了HEAP DUMP heap name="sga heap(7,0)" desc=0x600963e0以下的內容.
# cat b3.txt | bc -q | uniq -c
2826 7
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2784877/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20210708]使用那個shared pool latch.txt
- [20220406]使用那個shared pool latch的疑問1.txt
- [20210512]shared pool latch與library cache latch的簡單探究.txt
- [20190319]shared pool latch與library cache latch的簡單探究.txt
- [20220412]shared pool latch與使用sga heap的疑問2.txt
- [20220413]shared pool latch與使用sga heap的疑問3.txt
- [20210520]11g shared pool latch與library cache mutex的簡單探究.txtMutex
- [20190419]shared latch spin count.txt
- [20210521]11g shared pool latch與library cache mutex的簡單探究4.txtMutex
- [20210520]11g shared pool latch與library cache mutex的簡單探究3.txtMutex
- [20190419]shared latch spin count 2.txt
- [20210218]shared latch spin count 6.txt
- [20210218]shared latch spin count 5.txt
- [20200213]使用DBMS_SHARED_POOL.MARKHOT的總結.txt
- [20190415]關於shared latch(共享栓鎖).txt
- [20200126]使用DBMS_SHARED_POOL.MARKHOT與sql語句.txtSQL
- [20200212]使用DBMS_SHARED_POOL.MARKHOT標識熱物件.txt物件
- [20190102]DBMS_SHARED_POOL.MARKHOT與表.txt
- [20190416]檢視shared latch gets的變化.txt
- [20220419]19c _enable_shared_pool_durations.txt
- [20191219]shared_pool_size設定躍變.txt
- [20210208][20200426]檢視shared latch gets的變化.txt
- [20190416]完善shared latch測試指令碼2.txt指令碼
- [20200212]使用DBMS_SHARED_POOL.MARKHOT與sql語句3.txtSQL
- [20200213]使用DBMS_SHARED_POOL.MARKHOT標識熱物件2.txt物件
- [20200211]使用DBMS_SHARED_POOL.MARKHOT與sql語句2.txtSQL
- [20201117]使用DBMS_SHARED_POOL.MARKHOT與sql語句5.txtSQL
- [20201117]使用DBMS_SHARED_POOL.MARKHOT與sql語句6.txtSQL
- 透過案例學調優之--和 SHARED POOL 相關的主要 Latch
- [20200212]使用DBMS_SHARED_POOL.MARKHOT與檢視v$open_cursor.txt
- [20200212]使用DBMS_SHARED_POOL.MARKHOT與sql的計算2.txtSQL
- [20200211]使用DBMS_SHARED_POOL.MARKHOT與sql_id的計算.txtSQL
- 共享池 shared pool
- [20210803]如何驗證.txt
- [20200217]使用snapper探究DBMS_SHARED_POOL.MARKHOT標識熱物件的等待事件.txtAPP物件事件
- Oracle Shared Pool Memory ManagementOracle
- [20180928]ora-01426(補充).txt
- [20211221]記錄使用sqlplus的小問題補充.txtSQL