SGA中Latch 的分類和查詢--結合v$latch檢視
SGA中Latch 的分類和查詢
SGA中Latch分兩類:(1)願意等的LATCH(willing-to_wait)
(2)不願意等 immediate
CBC 多個BH組成 Cache Buffer Chain (CBC)
例如:CBC Latch的產生次數的查詢:
SYS@ bys3>col name for a20SYS@ bys3>select NAME,GETS ,MISSES ,SLEEPS ,IMMEDIATE_GETS, IMMEDIATE_MISSES from v$latch where name like '%cache buffers chains%';
NAME GETS MISSES SLEEPS IMMEDIATE_GETS IMMEDIATE_MISSES
-------------------- ---------- ---------- ---------- -------------- ----------------
cache buffers chains 2006932 0 0 78095 0
v$latch各欄位描述:--來自官方文件
GETS Number of times the latch was requested in willing-to-wait mode在願意等待模式獲取鎖的次數
MISSES Number of times the latch was requested in willing-to-wait mode and the requestor had to wait願意等待模式,請求者請求LATCH不成功後等待的次數
SLEEPS Number of times a willing-to-wait latch request resulted in a session sleeping while waiting for the latch在願意等待模式導致一個會話SLEEP的次數
IMMEDIATE_GETS Number of times a latch was requested in no-wait mode 立即獲取latch成功的次數
IMMEDIATE_MISSES Number of times a no-wait latch request did not succeed (that is, missed)立即獲取latch不成功的次數
###################################
v$latch檢視的查詢
SYS@ bys3>select count(*) from v$latch; --ORACLE版本為11.2.0.4,鎖有582種COUNT(*)
----------
582
SYS@ bys3>select count(*) from v$latch where IMMEDIATE_GETS+IMMEDIATE_MISSES>0; --願意等待willing-to-wait的latch
COUNT(*)
----------
35
SYS@ bys3>select count(*) from v$latch where IMMEDIATE_GETS+IMMEDIATE_MISSES=0; ---不願意等待immediate的latch
COUNT(*)
----------
547
################
關於willing-to-wait模式時請求者請求LATCH不成功後等待的次數涉及_spin_count引數:預設值2000,即SPIN2000次仍不能獲取latch才sleep.
SYS@ bys3>@?/rdbms/admin/show_para --指令碼具體內容見:http://blog.csdn.net/haibusuanyun/article/details/17140197 第二小節。
Enter value for p: spin
old 3: WHERE i.inst_id = USERENV ('Instance') AND CV.inst_id = USERENV ('Instance') AND i.indx = CV.indx AND upper(i.ksppinm) LIKE upper('%&p%') ORDER BY REPLACE (i.ksppinm, '_', '')
new 3: WHERE i.inst_id = USERENV ('Instance') AND CV.inst_id = USERENV ('Instance') AND i.indx = CV.indx AND upper(i.ksppinm) LIKE upper('%spin%') ORDER BY REPLACE (i.ksppinm, '_', '')
P_NAME P_DESCRIPTION P_VALUE ISDEFAULT ISMODIFIED ISADJ
------------------ ------------------------ ---------- --------- ---------- -----
_lm_lms_spin make lms not sleep FALSE TRUE FALSE FALSE
_mutex_spin_count Mutex spin count 255 TRUE FALSE FALSE
_spin_count Amount to spin waiting for a latch 1 TRUE FALSE FALSE
這裡因為是虛擬機器上,使用的單核心,所以_spin_count為1,雙核時即為預設值:2000
show parameter cpu 可檢視當前CPU情況。
#############
一個latch對應幾個桶buckets呢?預設是32,我這裡是16.計算如下:
SYS@ bys3>@?/rdbms/admin/show_paraEnter value for p: db_block_hash
old 3: WHERE i.inst_id = USERENV ('Instance') AND CV.inst_id = USERENV ('Instance') AND i.indx = CV.indx AND upper(i.ksppinm) LIKE upper('%&p%') ORDER BY REPLACE (i.ksppinm, '_', '')
new 3: WHERE i.inst_id = USERENV ('Instance') AND CV.inst_id = USERENV ('Instance') AND i.indx = CV.indx AND upper(i.ksppinm) LIKE upper('%db_block_hash%') ORDER BY REPLACE (i.ksppinm, '_', '')
P_NAME P_DESCRIPTION P_VALUE ISDEFAULT ISMODIFIED ISADJ
---------------------------------------- -------------------------------------------------- ------------------------------ --------- ---------- -----
_db_block_hash_buckets Number of database block hash buckets 16384 TRUE FALSE FALSE
_db_block_hash_latches Number of database block hash latches 1024 TRUE FALSE FALSE
16384/1024=16
###################
一個latch的大小是:
select to_number(b.addr,'xxxxxxxxxxxxxxxxxxxx')-to_number(a.addr,'xxxxxxxxxxxxx')from
(select rownum rn,addr from v$latch_children
where name='cache buffers chains' order by addr) a,
(select rownum rn,addr from v$latch_children
where name='cache buffers chains' order by addr) b
WHERE a.rn=b.rn+1 and rownum<100;
在ORACLE版本為11.2.0.4中為124byte.如果連續多個的latch,在查詢中會被合併計算,顯示為124的整數倍。
相關文章
- oracle 11g latch之v$latch系列二Oracle
- oracle 11g latch之v$latch系列三Oracle
- 學習動態效能表(11)--v$latch$v$latch_children
- oracle 11g latch之v$latch和systemstate dump檔案之系列四Oracle
- 授權某使用者,檢視動態效能檢視的許可權(如v$latch,v$lock,v$sqlarea,v$sql,v$sysstat)SQL
- (轉):學習Oracle動態效能表-(11)-v$latch$ v$latch_childrenOracle
- Oracle中latch和lock的區別Oracle
- v$latch 的wait_timeAI
- 從oracle v$version檢視中查詢os的資訊Oracle
- Oracle Latch及latch衝突Oracle
- Latch總結筆記筆記
- Oracle中的redo copy latchOracle
- 【 latch和lock的區別 】
- latch和lock的區別
- 深入理解Oracle中的latchOracle
- Oracle KSL Latch 管理層 與 Latch管理Oracle
- 查詢SGA和PGA大小
- Latch和Lock的區別(轉)
- latch free 中 cache buffer chain 的整理AI
- 基於row cache object latch研究對於sga抖動的影響Object
- latch入門?(最新更新part4:這才是真正的latch)---你所不知道的latch
- cbc latch或cache buffer chains latch系列一AI
- Oracle Latch & LockOracle
- [20190416]檢視shared latch gets的變化.txt
- 10.2出現SQL Memory Manager latch型別的latch freeSQL型別
- cr塊和latch buffer cache chainAI
- snapshot 和 view,lock 和 latch 的區別View
- mutex,latch,lock,enqueue hash chains latch基礎概念MutexENQAI
- Identify Which Latch is Associated with a "latch free" wait-413942.1IDEAI
- [20200211]檢視v$db_object_cache的CHILD_LATCH欄位.txtObject
- latch free事件的整理事件
- v$session/v$process檢視涉及的相關會話資訊的查詢Session會話
- 儲存過程中查詢資料字典檢視(v$或dba)儲存過程
- 獲取v$latch資料來源實驗
- 【SQL】Oracle查詢轉換之檢視合併SQLOracle
- 【檢視】深入探究 V$PARAMETER的底層查詢內幕
- ORACLE LOCK,LATCH,PINOracle
- Oracle Latch 說明Oracle