如何解决library cache pin及library cache lock故障

发布时间:2021-11-12 14:05:27 作者:柒染
来源:亿速云 阅读:404

这期内容当中小编将会给大家带来有关如何解决library cache pin及library cache lock故障,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

某个客户, 突然发生前端零售业务卡顿的情况。因为当时在处理其他客户的事宜, 所以当时没有进行monitor。由另外一位同事进行处理, 直接紧急重启了应用。
问题解决。但是业务不得已中断。
事后调查原因, 从卡顿的时间段来看发现大量的library cache pin等待事件,并且伴有library cache lock。
如何解决library cache pin及library cache lock故障
另外,同事也保存了阻塞相关的会话信息
create table block_sess1018 as
select *  from v$session where blocking_session is not null
结合
select * from dba_hist_active_sess_history h where h.sample_time > to_date('20171018 15:25:00', 'yyyymmdd hh34:mi:ss')
and  h.sample_time < to_date('20171018 16:00:00', 'yyyymmdd hh34:mi:ss') and event like 'library cache%'

library cache pin几个参数的意思:

p1=handle address
p2=pin address
p3=namespace&&encoded mode

对于p1raw可以对应于x$kglob中的KGLHDADR字段x$kglpn中的KGLPNHDL字段,x$kgllk中的KGLLKHDL字段,后边有sql关联。

dba_hist_active_sess_history中的P1可以转换成16进制之后,再去v$object_dependency通过to_address定位到pin的对象


SQL> select  s.sid, s.saddr, sw.p1raw
     from v$session_wait sw, v$session s
     where sw.sid = s.sid and sw.event='library cache pin';

       SID SADDR            P1RAW
---------- ---------------- ----------------
        53 0000000077204A80 000000006DBC5BE8  

Now using the P1RAW and SADDR values find the the address of the user session that is holding the lock

SQL> select b.KGLLKUSE from dba_kgllock w , dba_kgllock b
     where w.KGLLKHDL  = b.KGLLKHDL
     and   w.KGLLKREQ  > 0 and b.KGLLKMOD > 0
     and   w.KGLLKTYPE = b.KGLLKTYPE
     and   w.KGLLKUSE  = '0000000077204A80' -- SADDR
     and   w.KGLLKHDL  = '000000006DBC5BE8' -- P1RAW

 select to_owner, to_name from v$object_dependency 
     where to_address = '000000016B500270';

select * from dba_ddl_locks where owner = 'HR';

找到了library cache pin的对象。

再进一步发现(通过logminer挖掘日志),故障开始前,有开发的同事对一个基础表进行了DDL操作,引发了其后一连串的编译的动作(有很多对象依赖于此表)。
很多对象,比如触发器(产品的逻辑很多是用触发器完成), 过程,函数,视图等依赖于此表。
由于此时正值业务高峰,所以出现了大面积的卡顿。

以下是DDL时间顺序

如何解决library cache pin及library cache lock故障


执行的DDL语句:
如何解决library cache pin及library cache lock故障

上述就是小编为大家分享的如何解决library cache pin及library cache lock故障了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注亿速云行业资讯频道。

推荐阅读:
  1. Oracle Library Cache的示例分析
  2. 如何简单阅读library cache dump

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

library cache pin library cache lock

上一篇:hadoop安装配置会遇到什么问题

下一篇:Django中的unittest应用是什么

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》