设为首页 收藏本站
查看: 589|回复: 0

[经验分享] Oracle Library Cache深入解析

[复制链接]

尚未签到

发表于 2018-9-11 12:59:26 | 显示全部楼层 |阅读模式
案例1:  
业务运行前:
  
17:07:30 SYS@ prod>select name,GETS,MISSES  from v$latch where upper(name) like '%LIBRARY%'  OR upper(name) like '%SHARE%';
  
NAME                                                                   GETS     MISSES
  
---------------------------------------------------------------- ---------- ----------
  
test shared non-parent l0                                                 0          0
  
ksxp shared latch                                                         0          0
  
kcfis stats shared latch                                                  0          0
  
shared pool                                                          126676         61
  
library cache load lock                                                   0          0
  
shared pool simulator                                                  6576          0
  
shared pool sim alloc                                                    45          0
  
Shared B-Tree                                                           302          0
  
shared server configuration                                               6          0
  
shared server info                                                        1          0
  
运行业务:
  
17:08:34 SCOTT@ prod>begin
  
17:08:38   2  for i in 1..100000 loop
  
17:08:52   3  execute immediate 'insert into t1 values ('||i||')';
  
17:09:18   4  end loop;
  
17:09:26   5  end;
  
17:09:27   6  /
  
PL/SQL procedure successfully completed.
  
业务运行后:
  
17:11:05 SYS@ prod>select name,GETS,MISSES  from v$latch where upper(name) like '%LIBRARY%'  OR upper(name) like '%SHARE%'
  
NAME                                                                   GETS     MISSES
  
---------------------------------------------------------------- ---------- ----------
  
test shared non-parent l0                                                 0          0
  
ksxp shared latch                                                         0          0
  
kcfis stats shared latch                                                  0          0
  
shared pool                                                         4526672        214
  
library cache load lock                                                   0          0
  
shared pool simulator                                               1086437          0
  
shared pool sim alloc                                                  2048          0
  
Shared B-Tree                                                           316          0
  
shared server configuration                                               6          0
  
shared server info                                                        1          0
  
10 rows selected.
  
17:15:42 SYS@ prod>select sid,event,WAIT_TIME,state from v$session_wait where sid=42
  
       SID EVENT                                                             WAIT_TIME STATE
  
---------- ---------------------------------------------------------------- ---------- -------------------
  
        42 latch: shared pool                                                       -1 WAITED SHORT TIME
  
Elapsed: 00:00:00.08
  

  
案例2:
  
业务运行前:
  
17:18:35 SYS@ prod>select sid,EVENT,TOTAL_WAITS,AVERAGE_WAIT  from v$session_event where sid in (42,46);
  
       SID EVENT                                                            TOTAL_WAITS AVERAGE_WAIT
  
---------- ---------------------------------------------------------------- ----------- ------------
  
        42 Disk file operations I/O                                                   4          .03
  
        42 log file switch (private strand flush incomplete)                          1        10.03
  
        42 log file sync                                                              4         1.76
  
        42 db file sequential read                                                  385          .23
  
        42 latch: row cache objects                                                   5          .44
  
        42 latch: shared pool                                                       194          .25
  
        42 SQL*Net message to client                                                 24            0
  
        42 SQL*Net message from client                                               23       5318.9
  
        42 SQL*Net break/reset to client                                              2          .08
  
        42 events in waitclass Other                                                  1            0
  
        46 Disk file operations I/O                                                   1          .03
  
        46 db file sequential read                                                   33          .02
  
        46 SQL*Net message to client                                                 13            0
  
        46 SQL*Net message from client                                               12         79.9
  
14 rows selected.
  
运行业务:
  
17:16:39 SYS@ prod>select sid ,username from v$session where username is not null;
  
       SID USERNAME
  
---------- ------------------------------
  
         1 SYS
  
        42 SCOTT
  
        46 HR
  

  
17:17:22 SCOTT@ prod>begin
  
17:20:46   2  for i in 1..100000 loop
  
17:20:52   3  execute immediate 'insert into t1 values ('||i||')';
  
17:20:58   4  end loop;
  
17:21:02   5  end;
  
17:21:05   6  /
  
PL/SQL procedure successfully completed.
  
17:17:42 HR@ prod>begin
  
17:21:16   2  for i in 1..100000 loop
  
17:21:24   3  execute immediate 'insert into scott.t1 values ('||i||')';
  
17:21:49   4  end loop;
  
17:21:51   5  end;
  
17:21:52   6  /
  
PL/SQL procedure successfully completed.
  
业务运行后:
  
17:22:32 SYS@ prod>select sid,EVENT,TOTAL_WAITS,AVERAGE_WAIT  from v$session_event where sid in (42,46);
  
       SID EVENT                                                            TOTAL_WAITS AVERAGE_WAIT
  
---------- ---------------------------------------------------------------- ----------- ------------
  
        42 Disk file operations I/O                                                   4          .03
  
        42 latch: cache buffers chains                                               16          .18
  
        42 buffer busy waits                                                          2          .15
  
        42 log file switch (private strand flush incomplete)                          1        10.03
  
        42 log file sync                                                              4         1.76
  
        42 db file sequential read                                                  413          .21
  
        42 latch: row cache objects                                                  58          .13
  
        42 latch: shared pool                                                      1008          .19
  
        42 library cache: mutex X                                                   123          .33
  
        42 SQL*Net message to client                                                 24            0
  
        42 SQL*Net message from client                                               24      6044.43
  
        42 SQL*Net break/reset to client                                              2          .08
  
        42 events in waitclass Other                                                 87          .09
  
        46 Disk file operations I/O                                                   3          .03
  
        46 latch: cache buffers chains                                               13          .21
  
        46 buffer busy waits                                                          1          .35
  
        46 latch: redo copy                                                           1         1.26
  
       SID EVENT                                                            TOTAL_WAITS AVERAGE_WAIT
  
---------- ---------------------------------------------------------------- ----------- ------------
  
        46 db file sequential read                                                   38          .02
  
        46 enq: HW - contention                                                       1          .01
  
        46 latch: row cache objects                                                  58          .14
  
        46 row cache lock                                                             1          .08
  
        46 latch: shared pool                                                       666          .17
  
        46 library cache: mutex X                                                    99          .29
  
        46 SQL*Net message to client                                                 13            0
  
        46 SQL*Net message from client                                               13      2010.63
  
        46 events in waitclass Other                                                 68          .14
  
26 rows selected.
  
Elapsed: 00:00:00.37
  
17:22:42 SYS@ prod>
  
17:22:02 SYS@ prod>select sid,event,WAIT_TIME,state from v$session_wait where sid=42
  
17:22:25   2   or sid=46;
  
       SID EVENT                                                             WAIT_TIME STATE
  
---------- ---------------------------------------------------------------- ---------- -------------------
  
        42 latch: shared pool                                                       -1 WAITED SHORT TIME
  
        46 latch: shared pool                                                       -1 WAITED SHORT TIME



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-572151-1-1.html 上篇帖子: How can you start triaging the slow performance in Oracle database? 下篇帖子: 查询ORACLE数据库操作记录
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表