[20190416]檢視shared latch gets的變化.txt
[20190416]檢視shared latch gets的變化.txt
1.環境:
SYS@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
SYS@book> select addr,name,level#,GETS,MISSES,SLEEPS,IMMEDIATE_GETS,IMMEDIATE_MISSES,WAITERS_WOKEN,WAITS_HOLDING_LATCH,SPIN_GETS,WAIT_TIME from v$latch_parent where lower(name) like '%'||lower('&&1')||'%';
ADDR NAME LEVEL# GETS MISSES SLEEPS IMMEDIATE_GETS IMMEDIATE_MISSES WAITERS_WOKEN WAITS_HOLDING_LATCH SPIN_GETS WAIT_TIME
---------------- ---------------------------------------- ---------- ---------- ---------- ---------- -------------- ---------------- ------------- ------------------- ---------- ----------
0000000060018A18 gcs partitioned table hash 6 630 69 73 0 0 0 0 0 541058918
--//補充一點我發現空掃描v$latch也會導致gets的增加.掃描 v$latch_parent不會.
2.測試:
$ cat peek.sh
#! /bib/bash
# 引數如下:latch_name Monitoring_duration
sqlplus -s -l / as sysdba <<EOF
col laddr new_value laddr
SELECT sysdate,addr laddr FROM v\$latch_parent WHERE NAME='$1';
oradebug setmypid
$(seq $2|xargs -I{} echo -e 'oradebug peek 0x&laddr 60\nhost sleep 1' )
EOF
--//修改peek檢視的長度60.
$ cat i3.sh
#! /bin/bash
zdate=$(date '+%H%M%S')
echo $zdate
source peek.sh 'gcs partitioned table hash' 36 | timestamp.pl >| /tmp/peeks_${zdate}.txt &
seq 36 | xargs -I{} echo -e 'sqlplus -s -l / as sysdba <<< @latch_free\nsleep 1' | bash >| /tmp/latch_free_${zdate}.txt &
# 引數如下: @ latch.txt latch_name willing why where mode sleep_num
sqlplus /nolog @ shared_latch.txt 'gcs partitioned table hash' 1 4 5 8 6 > /dev/null &
sleep 2
sqlplus /nolog @ shared_latch.txt 'gcs partitioned table hash' 1 7 8 8 6 > /dev/null &
sleep 2
sqlplus /nolog @ shared_latch.txt 'gcs partitioned table hash' 1 9 10 8 6 > /dev/null &
sleep 2
sqlplus /nolog @ shared_latch.txt 'gcs partitioned table hash' 1 11 12 8 6 > /dev/null &
wait
$ grep -v '^.*: $' /tmp/peeks_153425.txt | cut -c10- | uniq -c
1 SYSDATE LADDR
1 ------------------- ----------------
1 2019-04-16 15:34:25 0000000060018A18
1 Statement processed.
2 [060018A18, 060018A54) = 00000001 00000000 00000277 00000096 00000006 00000005 00000004 00000000 00000000 00000045 00000000 00000000 203FE766 00000000 00000049
2 [060018A18, 060018A54) = 00000002 00000000 00000278 00000096 00000006 00000008 00000007 00000000 00000000 00000045 00000000 00000000 203FE766 00000000 00000049
2 [060018A18, 060018A54) = 00000003 00000000 00000279 00000096 00000006 0000000A 00000009 00000000 00000000 00000045 00000000 00000000 203FE766 00000000 00000049
2 [060018A18, 060018A54) = 00000003 00000000 0000027A 00000096 00000006 0000000C 0000000B 00000000 00000000 00000045 00000000 00000000 203FE766 00000000 00000049
2 [060018A18, 060018A54) = 00000002 00000000 0000027A 00000096 00000006 0000000C 0000000B 00000000 00000000 00000045 00000000 00000000 203FE766 00000000 00000049
2 [060018A18, 060018A54) = 00000001 00000000 0000027A 00000096 00000006 0000000C 0000000B 00000000 00000000 00000045 00000000 00000000 203FE766 00000000 00000049
24 [060018A18, 060018A54) = 00000000 00000000 0000027A 00000096 00000006 0000000C 0000000B 00000000 00000000 00000045 00000000 00000000 203FE766 00000000 00000049
SYS@book> select addr,name,level#,GETS,MISSES,SLEEPS,IMMEDIATE_GETS,IMMEDIATE_MISSES,WAITERS_WOKEN,WAITS_HOLDING_LATCH,SPIN_GETS,WAIT_TIME from v$latch_parent where lower(name) like '%'||lower('&&1')||'%';
ADDR NAME LEVEL# GETS MISSES SLEEPS IMMEDIATE_GETS IMMEDIATE_MISSES WAITERS_WOKEN WAITS_HOLDING_LATCH SPIN_GETS WAIT_TIME
---------------- ---------------------------------------- ---------- ---------- ---------- ---------- -------------- ---------------- ------------- ------------------- ---------- ----------
0000000060018A18 gcs partitioned table hash 6 634 69 73 0 0 0 0 0 541058918
--//0x27A=634
--//0x277=631
--//0x45=69
--//0x49=73
--//上下對比可以發現MISSES,SLEEPS次數沒有變化.gets增加4次.WAIT_TIME的時間也沒有變化.
$ cat i4.sh
#! /bin/bash
zdate=$(date '+%H%M%S')
echo $zdate
source peek.sh 'gcs partitioned table hash' 36 | timestamp.pl >| /tmp/peeks_${zdate}.txt &
seq 36 | xargs -I{} echo -e 'sqlplus -s -l / as sysdba <<< @latch_free\nsleep 1' | bash >| /tmp/latch_free_${zdate}.txt &
# 引數如下: @ latch.txt latch_name willing why where mode sleep_num
sqlplus /nolog @ shared_latch.txt 'gcs partitioned table hash' 1 4 5 x 6 > /dev/null &
sleep 2
sqlplus /nolog @ shared_latch.txt 'gcs partitioned table hash' 1 7 8 s 6 > /dev/null &
sleep 2
sqlplus /nolog @ shared_latch.txt 'gcs partitioned table hash' 1 9 10 s 6 > /dev/null &
sleep 1.9
sqlplus /nolog @ shared_latch.txt 'gcs partitioned table hash' 1 11 12 s 6 > /dev/null &
wait
SYS@book> select addr,name,level#,GETS,MISSES,SLEEPS,IMMEDIATE_GETS,IMMEDIATE_MISSES,WAITERS_WOKEN,WAITS_HOLDING_LATCH,SPIN_GETS,WAIT_TIME from v$latch_parent where lower(name) like '%'||lower('&&1')||'%';
ADDR NAME LEVEL# GETS MISSES SLEEPS IMMEDIATE_GETS IMMEDIATE_MISSES WAITERS_WOKEN WAITS_HOLDING_LATCH SPIN_GETS WAIT_TIME
---------------- ---------------------------------------- ---------- ---------- ---------- ---------- -------------- ---------------- ------------- ------------------- ---------- ----------
0000000060018A18 gcs partitioned table hash 6 634 69 73 0 0 0 0 0 541058918
$ grep -v '^.*: $' /tmp/peeks_153730.txt | cut -c10- | uniq -c
1 SYSDATE LADDR
1 ------------------- ----------------
1 2019-04-16 15:37:30 0000000060018A18
1 Statement processed.
6 [060018A18, 060018A54) = 00000015 20000000 0000027B 00000096 00000006 00000005 00000004 00000000 00000000 00000045 00000000 00000000 203FE766 00000000 00000049
6 [060018A18, 060018A54) = 00000001 00000000 0000027C 00000096 00000006 00000008 00000007 00000000 00000000 00000046 00000000 00000000 207CF91C 00000000 0000004A
6 [060018A18, 060018A54) = 00000001 00000000 0000027D 00000096 00000006 0000000A 00000009 00000000 00000000 00000047 00000000 00000000 20F71FAA 00000000 0000004B
6 [060018A18, 060018A54) = 00000001 00000000 0000027E 00000096 00000006 0000000C 0000000B 00000000 00000000 00000048 00000000 00000000 21AFED4D 00000000 0000004C
12 [060018A18, 060018A54) = 00000000 00000000 0000027E 00000096 00000006 0000000C 0000000B 00000000 00000000 00000048 00000000 00000000 21AFED4D 00000000 0000004C
SYS@book> select addr,name,level#,GETS,MISSES,SLEEPS,IMMEDIATE_GETS,IMMEDIATE_MISSES,WAITERS_WOKEN,WAITS_HOLDING_LATCH,SPIN_GETS,WAIT_TIME from v$latch_parent where lower(name) like '%'||lower('&&1')||'%';
ADDR NAME LEVEL# GETS MISSES SLEEPS IMMEDIATE_GETS IMMEDIATE_MISSES WAITERS_WOKEN WAITS_HOLDING_LATCH SPIN_GETS WAIT_TIME
---------------- ---------------------------------------- ---------- ---------- ---------- ---------- -------------- ---------------- ------------- ------------------- ---------- ----------
0000000060018A18 gcs partitioned table hash 6 638 72 76 0 0 0 0 0 565177677
--//上下比較,可以發現GETS增加4次,MISSES,SLEEPS增加3次.WAIT_TIME從565177677=>541058918, 相減等於24118759,可以猜測這個單位是微秒.換算後大約24秒.基本符合.
--//也可以發現持有該latch時,gets數量增加.
3.繼續測試:
--//如果大量的併發S mode會出現什麼情況呢?
$ cat i5.sh
#! /bin/bash
zdate=$(date '+%H%M%S')
echo $zdate
source peek.sh 'gcs partitioned table hash' 10 | timestamp.pl >| /tmp/peeks_${zdate}.txt &
seq 10 | xargs -I{} echo -e 'sqlplus -s -l / as sysdba <<< @latch_free\nsleep 1' | bash >| /tmp/latch_free_${zdate}.txt &
# 引數如下: @ latch.txt latch_name willing why where mode sleep_num
sleep 1
seq 100 | xargs -I {} -P 100 sqlplus /nolog @ shared_latch.txt 'gcs partitioned table hash' 1 4 {} s 6 > /dev/null
wait
--//100個會話併發的情況呢?
SYS@book> select addr,name,level#,GETS,MISSES,SLEEPS,IMMEDIATE_GETS,IMMEDIATE_MISSES,WAITERS_WOKEN,WAITS_HOLDING_LATCH,SPIN_GETS,WAIT_TIME from v$latch_parent where lower(name) like '%'||lower('&&1')||'%';
ADDR NAME LEVEL# GETS MISSES SLEEPS IMMEDIATE_GETS IMMEDIATE_MISSES WAITERS_WOKEN WAITS_HOLDING_LATCH SPIN_GETS WAIT_TIME
---------------- ---------------------------------------- ---------- ---------- ---------- ---------- -------------- ---------------- ------------- ------------------- ---------- ----------
0000000060018A18 gcs partitioned table hash 6 840 73 76 0 0 0 0 1 565177677
$ grep -v '^.*: $' /tmp/peeks_155301.txt | cut -c10- | uniq -c
1 SYSDATE LADDR
1 ------------------- ----------------
1 2019-04-16 15:53:01 0000000060018A18
1 Statement processed.
2 [060018A18, 060018A54) = 00000000 00000000 00000348 00000096 00000006 00000055 00000004 00000000 00000000 00000049 00000000 00000000 21AFED4D 00000000 0000004C
6 [060018A18, 060018A54) = 00000064 00000000 000003AC 00000096 00000006 0000001C 00000004 00000000 00000000 0000004C 00000000 00000000 21AFED4D 00000000 0000004C
2 [060018A18, 060018A54) = 00000000 00000000 000003AC 00000096 00000006 0000001C 00000004 00000000 00000000 0000004C 00000000 00000000 21AFED4D 00000000 0000004C
SYS@book> select addr,name,level#,GETS,MISSES,SLEEPS,IMMEDIATE_GETS,IMMEDIATE_MISSES,WAITERS_WOKEN,WAITS_HOLDING_LATCH,SPIN_GETS,WAIT_TIME from v$latch_parent where lower(name) like '%'||lower('&&1')||'%';
ADDR NAME LEVEL# GETS MISSES SLEEPS IMMEDIATE_GETS IMMEDIATE_MISSES WAITERS_WOKEN WAITS_HOLDING_LATCH SPIN_GETS WAIT_TIME
---------------- ---------------------------------------- ---------- ---------- ---------- ---------- -------------- ---------------- ------------- ------------------- ---------- ----------
0000000060018A18 gcs partitioned table hash 6 940 76 76 0 0 0 0 4 565177677
--//沒有問題計數正確!!沒有丟失.
--//0x21AFED4D=565177677,對應的是wait_time總和.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2641549/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20210208][20200426]檢視shared latch gets的變化.txt
- [20190416]完善shared latch測試指令碼2.txt指令碼
- [20190416]process allocation latch.txt
- [20190416]exclusive latch測試指令碼.txt指令碼
- [20190416]11g下那些latch是Exclusive的.txt
- [20190419]shared latch spin count.txt
- [20190319]shared pool latch與library cache latch的簡單探究.txt
- [20210512]shared pool latch與library cache latch的簡單探究.txt
- [20190419]shared latch spin count 2.txt
- [20210218]shared latch spin count 6.txt
- [20210218]shared latch spin count 5.txt
- [20190415]關於shared latch(共享栓鎖).txt
- [20210708]使用那個shared pool latch.txt
- [20210803]使用那個shared pool latch(補充).txt
- [20220406]使用那個shared pool latch的疑問1.txt
- [20220412]shared pool latch與使用sga heap的疑問2.txt
- [20220413]shared pool latch與使用sga heap的疑問3.txt
- [20200211]檢視v$db_object_cache的CHILD_LATCH欄位.txtObject
- [20210520]11g shared pool latch與library cache mutex的簡單探究.txtMutex
- [20200223]關於latch and mutext的優化.txtMutex優化
- [20200212]使用DBMS_SHARED_POOL.MARKHOT與檢視v$open_cursor.txt
- [20210521]11g shared pool latch與library cache mutex的簡單探究4.txtMutex
- [20210520]11g shared pool latch與library cache mutex的簡單探究3.txtMutex
- [20191219]shared_pool_size設定躍變.txt
- InnoDB LOCK檢視變化
- [20190506]檢視巢狀與繫結變數.txt巢狀變數
- [20240911]檢視超長檢視的定義2.txt
- [20190418]exclusive latch spin count.txt
- 透過案例學調優之--和 SHARED POOL 相關的主要 Latch
- [20180503]檢視提示使用索引.txt索引
- [20190415]10g下那些latch是共享的.txt
- [20190415]11g下那些latch是共享的.txt
- [20190324]奇怪的GV$FILESPACE_USAGE檢視.txt
- [20210422]如何檢視字元的ascii編碼.txt字元ASCII
- [20190409]latch get 引數where and why.txt
- [20210418]CBC latch再討論3.txt
- [20210419]CBC latch再討論4.txt
- [20210413]CBC latch再討論2.txt