0 0 508008338 391955 0 0 0 0 48 rows selected. --//你可以发现nowait latch 的一个特点,就是IMMEDIATE_GETS会相对很高.注我查询的生产系统的情况.测试环境不会这么高的.
http://andreynikolaev.wordpress.com/2010/04/12/latch-internals-information-sources/
--//参数如下,另外我前面blog写错了,where是最后1个参数。 kslgetl(laddr, wait, why, where) – Get exclusive latch
More precisely, to request the latch Oracle kernel needs: --//更准确地说,要请求闩锁Oracle内核需要:
laddress -- address of latch in SGA wait -- flag. If true, this is latch get in willing-to-wait mode.. why -- context why the latch is acquired at this where. where -- code for location from where the latch is acquired.
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
--//参考链接如下:http://blog.itpub.net/267265/viewspace-2641548/=>[20190416]exclusive latch测试脚本.txt
$ cat peek.sh #! /bib/bash # 参数如下:latch_name Monitoring_duration or laddr 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 8\nhost sleep 1' ) EOF
$ cat exclusive_latch.txt /* 参数如下: @ exclusive_latch.txt latch_name willing why where sleep_num */ --//connect / as sysdba col laddr new_value laddr SELECT addr laddr FROM v$latch_parent WHERE NAME='&&1'; oradebug setmypid oradebug call kslgetl 0x&laddr &&2 &&3 &&4 host sleep &&5 oradebug call kslfre 0x&laddr --//exit
$ cat y1.sh #! /bin/bash zdate=$(date '+%Y%m%d%H%M%S') echo $zdate source peek.sh 'test excl. parent2 l0' 20 | timestamp.pl >| /tmp/peekx_${zdate}.txt & seq 20 | xargs -I{} echo -e 'sqlplus -s -l / as sysdba <<< @latch_free\nsleep 1' | bash >| /tmp/latch_freeo_${zdate}.txt & # 参数如下: @ exclusive_latch.txt latch_name willing why where sleep_num sqlplus / as sysdba <<< "@ exclusive_latch.txt 'test excl. parent2 l0' 0 1 2 6" > /dev/null & sleep 2 sqlplus / as sysdba <<< "@ exclusive_latch.txt 'test excl. parent2 l0' 0 3 4 6" > /dev/null & sleep 4.1 sqlplus / as sysdba <<< "@ exclusive_latch.txt 'test excl. parent2 l0' 0 5 6 6" > /dev/null & wait
$ . y1.sh 20190424091250 [3]- Done |