ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 等待事件模拟(一)latch:library cache

等待事件模拟(一)latch:library cache

原创 Linux操作系统 作者:lsq_008 时间:2010-01-27 09:31:18 0 删除 编辑

1,创建2个sequence.
create sequence seq_0;
create sequence seq_1;

2.创建过程,循环打开并关闭游标,模拟大量的parse。

create or replace procedure p( p_n in number )
as
        l_cursor sys_refcursor;
begin
        for i in 1 .. p_n
        loop
                open l_cursor for 'select seq_' || mod(i,2)||'.nextval from dual';
                close l_cursor;
        end loop;
end;
/

3.执行以下脚本parse.sh。

sqlplus '/as sysdba'<alter session set events '10046 trace name context forever,level 12';
exec p(200000);
quit;
EOF
exit

nohup sh parse.sh &
nohup sh parse.sh &
nohup sh parse.sh &

4.查看awr报告里可见

Top 5 Timed Events                                         Avg %Total
~~~~~~~~~~~~~~~~~~                                        wait   Call
Event                                 Waits    Time (s)   (ms)   Time Wait Class
------------------------------ ------------ ----------- ------ ------ ----------
CPU time                                            186          34.2
latch: library cache                      6           1    116    0.1 Concurrenc
control file parallel write              67           1      8    0.1 System I/O
latch: library cache pin                  2           0    146    0.1 Concurrenc
log file parallel write                  24           0      6    0.0 System I/O

5。结论

过量软解析一样会导致latch: library cache等待。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10972173/viewspace-626114/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
十余年大型金融及电信系统数据库管理经验,曾服务于中国建设银行、中国移动。对oracle,mysql数据库有深入了解。 擅长python开发,独立开发了开源数据库自动化监控运维平台Power Monitor。

注册时间:2008-02-29

  • 博文量
    335
  • 访问量
    1369142