• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5122
  • Last Modified:

Wait event - Library cache lock

What does wait event - library cache lock  is ? how to resolve it ?
0
amolghadge
Asked:
amolghadge
  • 2
  • 2
1 Solution
 
sdstuberCommented:
It means you're parsing too often and one session has to wait to be able to get into the library to try to parse.

This is almost always caused by a failure to use bind variables.

0
 
sujith80Commented:
Use the following query to find, which session is doing the blocking. You can trace back from there what activities are causing the block.

select /*+ ordered use_nl(lob pn ses) */
decode(lob.kglobtyp, 0, 'NEXT OBJECT ', 1, 'INDEX ', 2, 'TABLE ', 3, 'CLUSTER ',
4, 'VIEW ', 5, 'SYNONYM ', 6, 'SEQUENCE ',
7, 'PROCEDURE ', 8, 'FUNCTION ', 9, 'PACKAGE ',
11, 'PACKAGE BODY ', 12, 'TRIGGER ',
13, 'TYPE ', 14, 'TYPE BODY ',
19, 'TABLE PARTITION ', 20, 'INDEX PARTITION ', 21, 'LOB ',
22, 'LIBRARY ', 23, 'DIRECTORY ', 24, 'QUEUE ',
28, 'JAVA SOURCE ', 29, 'JAVA CLASS ', 30, 'JAVA RESOURCE ',
32, 'INDEXTYPE ', 33, 'OPERATOR ',
34, 'TABLE SUBPARTITION ', 35, 'INDEX SUBPARTITION ',
40, 'LOB PARTITION ', 41, 'LOB SUBPARTITION ',
42, 'MATERIALIZED VIEW ',
43, 'DIMENSION ',
44, 'CONTEXT ', 46, 'RULE SET ', 47, 'RESOURCE PLAN ',
48, 'CONSUMER GROUP ',
51, 'SUBSCRIPTION ', 52, 'LOCATION ',
55, 'XML SCHEMA ', 56, 'JAVA DATA ',
57, 'SECURITY PROFILE ', 59, 'RULE ',
62, 'EVALUATION CONTEXT ',
'UNDEFINED ') object_type,
lob.kglnaobj object_name,
pn.kglpnmod lock_mode_held,
pn.kglpnreq lock_mode_requested,
ses.sid,
ses.serial#,
ses.username
from v$session_wait vsw,
x$kglob lob,
x$kglpn pn,
v$session ses
where vsw.event = 'library cache lock '
and vsw.p1raw = lob.kglhdadr
and lob.kglhdadr = pn.kglpnhdl
and pn.kglpnmod != 0
and pn.kglpnuse = ses.saddr
order by pn.kglpnmod desc, pn.kglpnreq desc
/

There are several reasons for this wait event, generally you may try the following.
-- increase the shared pool size
-- avoid running too many jobs in parallel, sequence your jobs
-- schedule activities like MV refreshes to off peak hours
-- upgrade to latest versions of oracle
--
0
 
amolghadgeAuthor Commented:
Ststuber: Thanks . But  I had only one session to the database . It was meant for dropping all the synonyms .
Sujith80 : I had tried to find out the blocking sessions also . but nothing could be found as blocking .

Problem was resolved after the bounce of the database . I am still not clear about the cause .
0
 
sujith80Commented:
>>  I had only one session to the database
You mean to say no other session was there at that moment?

>> It was meant for dropping all the synonyms
Frequent changes to object definitions will cause latches on the library cache as it has to re-load the changed definitions. That could be the reason.
See this link:
http://www.ixora.com.au/q+a/0101/19235723.htm
0
 
amolghadgeAuthor Commented:
Although problem was solved  . but your justifiaction to the problem convinces me .
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now