Performance tuning library cache lock & single-task message
My colleague suddenly encountered a problem today,a Database becomes very slow , and the a lot of session wait library cache lock event, Let me help him to look. DB env is 10.2.0.4 rac.
at first ,to generate a AWR manually.
exec dbms_workload_repository.create_snapshot;
@?/rdbms/admin/awrrpt Top 5 Timed Events Event Waits Time(s) Avg Wait(ms) % Total Call Time Wait Class
library cache lock 293,463 146,216 498 91.5 Concurrency
CPU time 10,861 6.8
db file sequential read 189,358 1,042 6 .7 User I/O
db file scattered read 79,436 421 5 .3 User I/O
log file sync 222,715 396 2 .2 Commit Library Cache Activity
"Pct Misses" should be very low
Namespace Get Requests Pct Miss Pin Requests Pct Miss Reloads Invali- dations
BODY 740 0.14 540,869 0.00 0 0
CLUSTER 5 0.00 9 0.00 0 0
INDEX 54 0.00 95 0.00 0 0
SQL AREA 32,041 2.45 24,489,123 -0.01 63 4
TABLE/PROCEDURE 855 5.15 750,579 0.01 34 0
TRIGGER 34 0.00 168,673 0.00 0 0
Back to Library Cache Statistics
Back to Top Library Cache Activity (RAC)
Namespace GES Lock Requests GES Pin Requests GES Pin Releases GES Inval Requests GES Invali- dations
CLUSTER 9 0 0 0 0
INDEX 95 4 0 1 0
TABLE/PROCEDURE 7,791 38 0 7 0
Riyaj Shamsudeen wrote in his blog that
”
Library cache locks aka parse locks are needed to maintain dependency mechanism between objects and their dependent objects like SQL etc. For example, if an object definition need to be modified or if parse locks are to be broken, then dependent objects objects must be invalidated. This dependency is maintained using library cache locks. For example, if a column is dropped from a table then all SQLs dependent upon the table must be invalidated and reparsed during next access to that object. Library cache locks are designed to implement this tracking mechanism.
”
The wait parameters of library cache lock & pin waits
are
p1 The address in the memory of the libraray cache handle
p2 The memory address of the lock and pin structure
p3 is encoded as 10*mode+namespace
mode = 3 shared, 5 exclusive
The namespaces are
0 cursor
1 Table, procedure & others
2 package body
3 trigger
4 index
5 cluster
6 object
7 pipe
Find blocker sessions holding the lib cache in RAC
select a.sid Holder ,a.SERIAL#,b.INST_ID,b.KGLPNUSE Sesion , b.KGLPNMOD Held, b.KGLPNREQ Req
from x$kglpn b , v$session a
where b.KGLPNHDL in (select p1raw from v$session_wait
where wait_time=0 and event like 'library cache%')
and b.KGLPNMOD <> 0
and a.saddr=b.kglpnuse ; HOLDER SERIAL# INST_ID SESION HELD REQ
---------- ---------- ---------- ---------------- ---------- ----------
6515 10005 2 C0000020F0122A20 2 0
What are the holders waiting for?
SQL> select username,program,machine,sql_id,status,wait_time,event ,p1,p2 from v$session where sid=6515; USERNAME PROGRAM MACHINE SQL_ID STATUS WAIT_TIME EVENT P1 P2
----------- --------------- ------------- ------------- -------- ---------- ------------------ ------- ----------
REPORT task@kybb1 (TNS V1-V3) kybb1 9u5jnnk50k3h7 KILLED 661 single-task message 0 0
Notice the session status was ‘KILLED‘ and event was ‘single-task message’.
what is event ‘single-task message’?
Oracle’s definition of the event:
When running single task, this event indicates that the session waits for the client side of the executable. Wait Time: Total elapsed time that this session spent in the user application.
where is the “the client side of the executable” came from? the I check the sql text.
SQL> select sql_text from v$sqlarea where sql_id='9u5jnnk50k3h7'; SQL_TEXT
--------------------------------------------------------------------------------
INSERT INTO STATQ_ZDKBYHXX_DAY
SELECT :B1 , :B4 , C.RES_TYPE_ID BRANDID1, N.RES_TYPE_NAME, SUBSTR(E.RECORGID, 1, 8) ORGID,
O.ORGNAME, COUNT(*) FROM TBCS.SUBS_REWARD A, TBCS.SUBSCRIBER B, IM.IM_INV_MOBTEL C, TBCS.REC_PRESENT D,
TBCS.REC_CHANGE F, TBCS.RECEPTION E, IM.IM_RES_TYPE@IM N, TBCS.ORGANIZATION O WHERE A.REGION
= :B1 AND B.ACTIVE = 1 AND A.REGION = B.REGION AND (EXISTS (SELECT 1 FROM TBCS.ORGANIZATION_CHILD T WHERE
... -- had truncated
AND A.STATUS = 1 AND A.SERIAL
I found the SQL call a dblink ,so “the client side ” is clear.
SQL> select sysdate from dual@IM;
SYSDATE
---------
28-JAN-15
the Db link is worked fine. but blocker session status was ‘KILLED’, it is still here . then try to kill the session again, when the blocker session is gone, the Waiting for the event ‘library cache lock’ has disappeared.
Performance tuning library cache lock & single-task message的更多相关文章
- rac数据库默认sql tuning advisor,导致大量library cache lock
rac数据库默认sql tuning advisor,导致大量library cache lock 问题现象:客户反映周六周日固定十点钟,一个程序会特别慢(大概10分钟),平时1到2秒.查看当时的日志 ...
- library cache lock和cursor: pin S wait on X等待
1.现象: 客户10.2.0.4 RAC环境,出现大量的library cache lock和cursor: pin S wait on X等待,经分析是由于统计信息收集僵死导致的.数据库在8点到9点 ...
- Library cache lock/pin详解
Library cache lock/pin 一.概述 ---本文是网络资料加metalink 等整理得来一个实例中的library cache包括了不同类型对象的描述,如:游标,索引,表,视图,过程 ...
- 深入理解shared pool共享池之library cache的library cache lock系列四
本文了解下等待事件library cache lock,进一步理解library cache,之前的文章请见: 深入理解shared pool共享池之library cache的library ca ...
- 如何使用event 10049分析定位library cache lock and library cache pin
Oracle Library Cache 的 lock 与 pin 说明 一. 相关的基本概念 之前整理了一篇blog,讲了Library Cache 的机制,参考: Oracle Library c ...
- library cache lock
SESSION 34 执行存储过程: SESSION 43 编译存储过程: SESSION 25 删除存储过程: 1.查询查看library cache lock等待事件的相关会话 SQL> s ...
- Library Cache: Lock, Pin and Load Lock
What is "Library cache lock" ? This event controls the concurrency between clients of the ...
- Library cache lock 故障解决一例
今天收到同事电话,说是数据库中一张名为acct_balance进行操作是奇慢,第一反映是不是扫行计划有问题,结果我错了,现将过程记录下来. 用pl/sql连上数据库情况:1.对acct_balance ...
- 外键约束列并没有导致大量建筑指数library cache pin/library cache lock
外键约束列并没有导致大量建筑指数library cache pin/library cache lock 清除一个100大数据表超过一百万线,发现已经运行了几个小时: delete B001.T_B1 ...
随机推荐
- .net常見面試題(三)
1, 请你说说.NET中类和结构的区别? 答:结构和类具有大体的语法,但是结构受到的限制比类要多.结构不能申明有默认的构造函数,为结构的副本是又编译器创建和销毁的,所以不需要默认的构造函数和析构函数. ...
- html背景为灰色 不能操作,中间div可以操作
<container style="position: absolute; top: 0px; left: 0px; width: 0px; height: 0px; z-index: ...
- 是C太傻逼?还是C++不够傻逼;
1,类对象宏object-like macro,类函数宏macro中不允许有空格,名称遵循变量名命名规则; 同样是笔记,顺序条理无,看管随意,意在与神会,不解释则会意此为深,随意则会意此乃为度...望 ...
- 2 weekend110的mapreduce介绍及wordcount + wordcount的编写和提交集群运行 + mr程序的本地运行模式
把我们的简单运算逻辑,很方便地扩展到海量数据的场景下,分布式运算. Map作一些,数据的局部处理和打散工作. Reduce作一些,数据的汇总工作. 这是之前的,weekend110的hdfs输入流之源 ...
- hdoj 1827 Summer Holiday【强连通分量&&缩点】
Summer Holiday Time Limit: 10000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)T ...
- VirtualBox检查更新失败解决办法
5.0————>5.1的更新: 1.VirtualBox5.0检查更新失败 2.官网下载最新版本 3.安装最新版本到原来旧版本的路径下 关键的地方来了:我可是担心坏了,怕安装新版本,会破坏原来已 ...
- selenuim +python环境配置遇到的诸多问题
自动化测试入门,总结一下安装selenium.python以及配置webdriver遇到的问题: 准备工作: 1.下载火狐浏览器并安装插件selenium IDE.Firebug~~ 2.下载安装py ...
- mysql技术调优资料整理
1,15 个有用的 MySQL/MariaDB 性能调整和优化技巧 2,MariaDB设置主从复制 3,CentOS6.4安装mysql2redis http://www.cnblogs ...
- springboot +spring security4 自定义手机号码+短信验证码登录
spring security 默认登录方式都是用户名+密码登录,项目中使用手机+ 短信验证码登录, 没办法,只能实现修改: 需要修改的地方: 1 .自定义 AuthenticationProvide ...
- sed和awk最佳入门教程
文档<sed和awk最佳入门教程>——摘自<实战linux shell编程与服务器管理>,简单易懂,适合初学者. 下载地址:http://download.csdn.net/d ...