50 = 0x96 4.如果看jonathan Lewis中文版本P60:

来源:这里教程网 时间:2026-03-03 16:30:21 作者:

SYS@book> @ viewlatch.sql 'gcs partitioned table hash' 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        296          0          0              0                0             0                   0          0          0 $ . i5.sh 105343 [1]-  Done                    source peek.sh 'gcs partitioned table hash' 10 | timestamp.pl >|/tmp/peeks_${zdate}.txt [2]+  Done                    seq 10 | xargs -I{} echo -e 'sqlplus -s -l / as sysdba <<< @latch_free\nsleep 1' | bash >|/tmp/latch_free_${zdate}.txt SYS@book> @ viewlatch.sql 'gcs partitioned table hash' 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        446          1          0              0                0             0                   0          1          0 --//并发执行150个进程获取gcs partitioned table hash latch,可以发现gets增加150,但是注意1个细节,出现1次MISSES,1次 --//SPIN_GETS。我一直以为大量share latch的请求不会出现阻塞进入SPIN,而实际上的测试还是有少量进入spin。 $ grep  -v '^.*: $' /tmp/peeks_105343.txt  | cut -c10- | uniq -c       1  SYSDATE             LADDR       1  ------------------- ----------------       1  2021-02-08 10:53:43 0000000060018A18       1  Statement processed.       2  [060018A18, 060018A54) = 00000000 00000000 00000128 00000096 00000006 00000010 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000       5  [060018A18, 060018A54) = 00000096 00000000 000001BE 00000096 00000006 0000005B 00000004 00000000 00000000 00000001 00000000 00000000 00000000 00000000 00000000       3  [060018A18, 060018A54) = 00000000 00000000 000001BE 00000096 00000006 0000005B 00000004 00000000 00000000 00000001 00000000 00000000 00000000 00000000 00000000 --//150 = 0x96 4.如果看jonathan Lewis<ORALCE 核心技术>中文版本P60: 表4-3 ------------------------------------------------------------------------- 需要的栓锁访问                                   使用方法 ------------------------------------------------------------------------- 以共享模式获取其他进程以共享模式持有的共享栓锁   休眠前仅自旋cou_count+2次. -------------------------------------------------------------------------- --// 英文版本P72: Table 4-3. Summary of Activity When a Latch Isn't Acquired on the First Attempt   ------------------------------------------------------------------------------------------------------------------ Required Latch Access                                        Method Used ------------------------------------------------------------------------------------------------------------------ Get exclusive latch                                          Attempt immediate get, go into spin cycle                                                              once (in this case the process spins 20,000                                                              times), attach to wait list, attempt immediate                                                              get, go to sleep                                                                Get shareable latch in exclusive mode when another           Go into spin cycle (in this case the process process is holding it in some mode (whether shared,          spins 2,000 times each cycle), attach to wait exclusive, or blocking)                                      list, repeat spin cycle, go to sleep if                                                              unsuccessful

相关推荐