library cache lock模拟小记

---压力测试的存储过程    
---测试用存储过程
create or replace procedure proc_hard_parse
as
v_cnt pls_integer;
begin
for i in 1..100000000 loop
select count(1) into v_cnt  from t_hps where 1=i;
end loop;
end;


---会话1  执行上述加压存储过程
SQL> exec proc_hard_parse;


--会话:2  对存储过程引用表ddl
SQL> alter table t_hps add c int;
 
Table altered

 

---会话3:马上发现产生了library cache lock
SQL> select sid,event from v$session where type='USER' and rownum<=20;
 
       SID EVENT
---------- ----------------------------------------------------------------
        36 SQL*Net message from client
        37 SQL*Net message to client
        38 SQL*Net message from client
        39 SQL*Net message from client
        40 library cache lock
        46 SQL*Net message from client
        48 SQL*Net message from client
        52 jobq slave wait
        57 jobq slave wait
 
9 rows selected


小结:1,当某个sql正在运行,所引用的对象发生了ddl变化,也包括grant,revoke等授权动作,则产生library cache lock
      2,library cache lock是为了获取 library cache handle
      3,而library cache pin则是正在运行存储过程或对象时,马上编译存储过程产生 library cache pin
     

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

转载于:http://blog.itpub.net/9240380/viewspace-759281/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值