设为首页 加入收藏

TOP

简单测试latch nowilling等待模式案例(二)
2019-05-23 14:49:02 】 浏览:221
Tags:简单 测试 latch nowilling 等待 模式 案例
ase 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                    sqlplus / as sysdba <<< "@ exclusive_latch.txt 'test excl. parent2 l0' 0 1 2 6" > /dev/null
[1]  Done                    source peek.sh 'test excl. parent2 l0' 20 | timestamp.pl >|/tmp/peekx_${zdate}.txt
[4]-  Done                    sqlplus / as sysdba <<< "@ exclusive_latch.txt 'test excl. parent2 l0' 0 3 4 6" > /dev/null
[5]+  Done                    sqlplus / as sysdba <<< "@ exclusive_latch.txt 'test excl. parent2 l0' 0 5 6 6" > /dev/null
[2]+  Done                    seq 20 | xargs -I{} echo -e 'sqlplus -s -l / as sysdba <<< @latch_free\nsleep 1' | bash >|/tmp/latch_freeo_${zdate}.txt


2.测试:
$ grep  -v '^.*: $' /tmp/peekx_20190424091250.txt | cut -c10- | uniq -c
      1  SYSDATE            LADDR
      1  ------------------- ----------------
      1  2019-04-24 09:12:50 0000000060009978
      1  Statement processed.
      6  [060009978, 060009980) = 00000015 00000000
      1  [060009978, 060009980) = 00000000 00000000
      6  [060009978, 060009980) = 00000015 00000000
      7  [060009978, 060009980) = 00000000 00000000
--//你可以发现第1个会话申请成功,第2个会话没有申请成功,直接退出.第3个会话申请成功(因为sleep 2+4.1秒).


--//cat /tmp/latch_freeo_20190424091250.txt
2019-04-24 09:12:50
2019-04-24 09:12:51
Process 21
 holding: 0000000060009978  "test e

首页 上一页 1 2 3 4 5 下一页 尾页 2/5/5
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Ubuntu 18.04下OpenCV测试代码 下一篇Python中关于元素替换的一些总结

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目