Library Cache Lock 2004-06-02 - By Khedr, Waleed
Check sessions using the table through v$access
Waleed
-- --Original Message-- --
From: David Sharples [mailto:dsharples@(protected)]
Sent: Wednesday, June 02, 2004 10:08 AM
To: oracle-l@(protected)
Subject: RE: library cache lock
Thanks very much - all I need to do now is go get sys access from the dba, all I have is dba rights at present
Dave
__ __
From: oracle-l-bounce@(protected) [mailto:oracle-l-bounce@(protected)] On Behalf Of Bobak, Mark
Sent: 02 June 2004 14:58
To: oracle-l@(protected)
Subject: RE: library cache lock
David,
Try the following query to find the blocked sessions and which session is the blocker.
Note that due to the order by, the first session should be the blocker.
-Mark
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
/
-- --Original Message-- --
From: oracle-l-bounce@(protected) [mailto:oracle-l-bounce@(protected)]On Behalf Of David Sharples
Sent: Wednesday, June 02, 2004 9:40 AM
To: oracle-l@(protected)
Subject: RE: library cache lock
I searched (probably on wrong words) didn 't return anything useful as I could see, can you show me a url?
__ __
From: oracle-l-bounce@(protected) [mailto:oracle-l-bounce@(protected)] On Behalf Of Khedr, Waleed
Sent: 02 June 2004 14:10
To: oracle-l@(protected)
Subject: RE: library cache lock
The metalink has answers for similar issues.
-- --Original Message-- --
From: David Sharples [mailto:dsharples@(protected)]
Sent: Wednesday, June 02, 2004 8:44 AM
To: oracle-l@(protected)
Subject: library cache lock
Hi, got a strange problem. I am trying to truncate a partition in a table, but it just hangs forever, it is waiting on a library cache lock. Anyone know why and how I can clear it - flushing the shared pool didn 't help and there are no other sessions touching that table.
Thanks
Dave
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN " >
<HTML xmlns= "http://www.w3.org/TR/REC-html40 " xmlns:v =
"urn:schemas-microsoft-com:vml " xmlns:o =
"urn:schemas-microsoft-com:office:office " xmlns:w =
"urn:schemas-microsoft-com:office:word " > <HEAD >
<META HTTP-EQUIV= "Content-Type " CONTENT= "text/html; charset=iso-8859-1 " >
<TITLE >library cache lock </TITLE >
<META content= "MSHTML 6.00.2800.1400 " name=GENERATOR > <!--[if !mso] >
<STYLE >v\:* {
BEHAVIOR: url(#default#VML)
}
o\:* {
BEHAVIOR: url(#default#VML)
}
w\:* {
BEHAVIOR: url(#default#VML)
}
.shape {
BEHAVIOR: url(#default#VML)
}
</STYLE >
<![endif]-- >
<STYLE >@(protected) {
font-family: Tahoma;
}
@(protected) Section1 {size: 612.0pt 792.0pt; margin: 72.0pt 90.0pt 72.0pt 90.0pt; }
P.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman "
}
LI.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman "
}
DIV.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman "
}
A:link {
COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline
}
P {
FONT-SIZE: 12pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; FONT-FAMILY: "Times New Roman "; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto
}
SPAN.EmailStyle18 {
COLOR: navy; FONT-FAMILY: Arial; mso-style-type: personal
}
SPAN.EmailStyle19 {
COLOR: navy; FONT-FAMILY: Arial; mso-style-type: personal-reply
}
DIV.Section1 {
page: Section1
}
</STYLE >
</HEAD >
<BODY lang=EN-US vLink=purple link=blue >
<DIV > <SPAN class=109374914-02062004 > <FONT color=#0000ff size=2 >Check sessions
using the table through v$access </FONT > </SPAN > </DIV >
<DIV > <SPAN class=109374914-02062004 > <FONT color=#0000ff
size=2 > </FONT > </SPAN > </DIV >
<DIV > <SPAN class=109374914-02062004 > <FONT color=#0000ff
size=2 >Waleed </FONT > </SPAN > </DIV >
<BLOCKQUOTE dir=ltr style= "MARGIN-RIGHT: 0px " >
<DIV class=OutlookMessageHeader dir=ltr align=left > <FONT face=Tahoma
size=2 >-- --Original Message-- -- <BR > <B >From: </B > David Sharples
[mailto:dsharples@(protected)] <BR > <B >Sent: </B > Wednesday, June 02,
2004 10:08 AM <BR > <B >To: </B > oracle-l@(protected) <BR > <B >Subject: </B > RE:
library cache lock <BR > <BR > </FONT > </DIV >
<DIV class=Section1 >
<P class=MsoNormal > <FONT face=Arial color=navy size=2 > <SPAN
style= "FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial " >Thanks very much –
all I need to do now is go get sys access from the dba, all I have is dba
rights at present <o:p > </o:p > </SPAN > </FONT > </P >
<P class=MsoNormal > <FONT face=Arial color=navy size=2 > <SPAN
style= "FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial " > <o:p > </o:p > </SPAN > </FONT > </P >
<P class=MsoNormal > <FONT face=Arial color=navy size=2 > <SPAN
style= "FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial " >Dave <o:p > </o:p > </SPAN > </FONT > </P >
<P class=MsoNormal > <FONT face=Arial color=navy size=2 > <SPAN
style= "FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial " > <o:p > </o:p > </SPAN > </FONT > </P >
<DIV >
<DIV class=MsoNormal style= "TEXT-ALIGN: center " align=center > <FONT
face= "Times New Roman " size=3 > <SPAN style= "FONT-SIZE: 12pt " >
<HR tabIndex=-1 align=center width= "100% " SIZE=2 >
</SPAN > </FONT > </DIV >
<P class=MsoNormal > <B > <FONT face=Tahoma size=2 > <SPAN
style= "FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma " >From: </SPAN > </FONT > </B > <FONT
face=Tahoma size=2 > <SPAN style= "FONT-SIZE: 10pt; FONT-FAMILY: Tahoma " >
oracle-l-bounce@(protected) [mailto:oracle-l-bounce@(protected)] <B > <SPAN
style= "FONT-WEIGHT: bold " >On Behalf Of </SPAN > </B >Bobak, Mark <BR > <B > <SPAN
style= "FONT-WEIGHT: bold " >Sent: </SPAN > </B > 02 June 2004 14:58 <BR > <B > <SPAN
style= "FONT-WEIGHT: bold " >To: </SPAN > </B > oracle-l@(protected) <BR > <B > <SPAN
style= "FONT-WEIGHT: bold " >Subject: </SPAN > </B > RE: library cache
lock </SPAN > </FONT > <o:p > </o:p > </P > </DIV >
<P class=MsoNormal > <FONT face= "Times New Roman " size=3 > <SPAN
style= "FONT-SIZE: 12pt " > <o:p > </o:p > </SPAN > </FONT > </P >
<DIV >
<P class=MsoNormal > <FONT face=Arial color=blue size=2 > <SPAN
style= "FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial " >David, </SPAN > </FONT > <o:p > </o:p > </P > </DIV >
<DIV >
<P class=MsoNormal > <FONT face= "Times New Roman " size=3 > <SPAN
style= "FONT-SIZE: 12pt " > <o:p > </o:p > </SPAN > </FONT > </P > </DIV >
<DIV >
<P class=MsoNormal > <FONT face=Arial color=blue size=2 > <SPAN
style= "FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial " >Try the following
query to find the blocked sessions and which session is the
blocker. </SPAN > </FONT > <o:p > </o:p > </P > </DIV >
<DIV >
<P class=MsoNormal > <FONT face=Arial color=blue size=2 > <SPAN
style= "FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial " >Note that due to the
order by, the first session should be the
blocker. </SPAN > </FONT > <o:p > </o:p > </P > </DIV >
<DIV >
<P class=MsoNormal > <FONT face= "Times New Roman " size=3 > <SPAN
style= "FONT-SIZE: 12pt " > <o:p > </o:p > </SPAN > </FONT > </P > </DIV >
<DIV >
<P class=MsoNormal > <FONT face=Arial color=blue size=2 > <SPAN
style= "FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial " >-Mark </SPAN > </FONT > <o:p > </o:p > </P > </DIV >
<DIV >
<P class=MsoNormal > <FONT face= "Times New Roman " size=3 > <SPAN
style= "FONT-SIZE: 12pt " > <o:p > </o:p > </SPAN > </FONT > </P > </DIV >
<DIV >
<P class=MsoNormal > <FONT face=Arial color=blue size=2 > <SPAN
style= "FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial " >select /*+ ordered
use_nl(lob pn ses) */ <BR >
decode(lob.kglobtyp, 0, 'NEXT OBJECT ', 1, 'INDEX ', 2, 'TABLE ', 3,
'CLUSTER ', <BR >
4, 'VIEW ', 5, 'SYNONYM ', 6,
'SEQUENCE ', <BR >
7, 'PROCEDURE ', 8, 'FUNCTION ', 9,
'PACKAGE ', <BR >
11, 'PACKAGE BODY ', 12,
'TRIGGER ', <BR >
13, 'TYPE ', 14, 'TYPE
BODY ', <BR >
19, 'TABLE PARTITION ', 20, 'INDEX PARTITION ', 21,
'LOB ', <BR >
22, 'LIBRARY ', 23, 'DIRECTORY ', 24,
'QUEUE ', <BR >
28, 'JAVA SOURCE ', 29, 'JAVA CLASS ', 30, 'JAVA
RESOURCE ', <BR >
32, 'INDEXTYPE ', 33,
'OPERATOR ', <BR >
34, 'TABLE SUBPARTITION ', 35, 'INDEX
SUBPARTITION ', <BR >
40, 'LOB PARTITION ', 41, 'LOB
SUBPARTITION ', <BR >
42, 'MATERIALIZED
VIEW ', <BR >
43,
'DIMENSION ', <BR >
44, 'CONTEXT ', 46, 'RULE SET ', 47, 'RESOURCE
PLAN ', <BR >
48, 'CONSUMER
GROUP ', <BR >
51, 'SUBSCRIPTION ', 52,
'LOCATION ', <BR >
55, 'XML SCHEMA ', 56, 'JAVA
DATA ', <BR >
57, 'SECURITY PROFILE ', 59,
'RULE ', <BR >
62, 'EVALUATION
CONTEXT ', <BR >
'UNDEFINED ') object_type, <BR > lob.kglnaobj
object_name, <BR > pn.kglpnmod
lock_mode_held, <BR > pn.kglpnreq
lock_mode_requested, <BR >
ses.sid, <BR >
ses.serial#, <BR > ses.username <BR >
from v$session_wait vsw, <BR > x$kglob
lob, <BR > x$kglpn
pn, <BR > v$session ses <BR > where
vsw.event = 'library cache lock ' <BR > and vsw.p1raw =
lob.kglhdadr <BR > and lob.kglhdadr = pn.kglpnhdl <BR >
and pn.kglpnmod != 0 <BR > and pn.kglpnuse =
ses.saddr </SPAN > </FONT > <o:p > </o:p > </P > </DIV >
<DIV >
<P class=MsoNormal > <FONT face=Arial color=blue size=2 > <SPAN
style= "FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial " >order by pn.kglpnmod
desc, pn.kglpnreq desc <BR >/ </SPAN > </FONT > <o:p > </o:p > </P > </DIV >
<BLOCKQUOTE style= "MARGIN-TOP: 5pt; MARGIN-BOTTOM: 5pt; MARGIN-RIGHT: 0cm " >
<P class=MsoNormal style= "MARGIN-BOTTOM: 12pt " > <FONT face=Tahoma
size=2 > <SPAN style= "FONT-SIZE: 10pt; FONT-FAMILY: Tahoma " >-- --Original
Message-- -- <BR > <B > <SPAN style= "FONT-WEIGHT: bold " >From: </SPAN > </B >
oracle-l-bounce@(protected) [mailto:oracle-l-bounce@(protected)] <B > <SPAN
style= "FONT-WEIGHT: bold " >On Behalf Of </SPAN > </B >David Sharples <BR > <B > <SPAN
style= "FONT-WEIGHT: bold " >Sent: </SPAN > </B > Wednesday, June 02, 2004 9:40
AM <BR > <B > <SPAN style= "FONT-WEIGHT: bold " >To: </SPAN > </B >
oracle-l@(protected) <BR > <B > <SPAN
style= "FONT-WEIGHT: bold " >Subject: </SPAN > </B > RE: library cache
lock </SPAN > </FONT > <o:p > </o:p > </P >
<P class=MsoNormal > <FONT face=Arial color=navy size=2 > <SPAN
style= "FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial " >I searched
(probably on wrong words) didn’t return anything useful as I could see, can
you show me a url? <o:p > </o:p > </SPAN > </FONT > </P >
<P class=MsoNormal > <FONT face=Arial color=navy size=2 > <SPAN
style= "FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial " > <o:p > </o:p > </SPAN > </FONT > </P >
<DIV >
<DIV class=MsoNormal style= "TEXT-ALIGN: center " align=center > <FONT
face= "Times New Roman " size=3 > <SPAN style= "FONT-SIZE: 12pt " >
<HR tabIndex=-1 align=center width= "100% " SIZE=2 >
</SPAN > </FONT > </DIV >
<P class=MsoNormal > <B > <FONT face=Tahoma size=2 > <SPAN
style= "FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma " >From: </SPAN > </FONT > </B > <FONT
face=Tahoma size=2 > <SPAN style= "FONT-SIZE: 10pt; FONT-FAMILY: Tahoma " >
oracle-l-bounce@(protected) [mailto:oracle-l-bounce@(protected)]
<B > <SPAN style= "FONT-WEIGHT: bold " >On Behalf Of </SPAN > </B >Khedr,
Waleed <BR > <B > <SPAN style= "FONT-WEIGHT: bold " >Sent: </SPAN > </B > 02 June 2004
14:10 <BR > <B > <SPAN style= "FONT-WEIGHT: bold " >To: </SPAN > </B >
oracle-l@(protected) <BR > <B > <SPAN
style= "FONT-WEIGHT: bold " >Subject: </SPAN > </B > RE: library cache
lock </SPAN > </FONT > <o:p > </o:p > </P > </DIV >
<P class=MsoNormal > <FONT face= "Times New Roman " size=3 > <SPAN
style= "FONT-SIZE: 12pt " > <o:p > </o:p > </SPAN > </FONT > </P >
<DIV >
<P class=MsoNormal > <FONT face= "Times New Roman " color=blue size=2 > <SPAN
style= "FONT-SIZE: 10pt; COLOR: blue " >The metalink has answers for similar
issues. </SPAN > </FONT > <o:p > </o:p > </P > </DIV >
<DIV >
<P class=MsoNormal > <FONT face= "Times New Roman " size=3 > <SPAN
style= "FONT-SIZE: 12pt " > <o:p > </o:p > </SPAN > </FONT > </P > </DIV >
<BLOCKQUOTE
style= "MARGIN-TOP: 5pt; MARGIN-BOTTOM: 5pt; MARGIN-RIGHT: 0cm " > <P
class=MsoNormal style= "MARGIN-BOTTOM: 12pt " > <FONT face=Tahoma size=2 > <SPAN
style= "FONT-SIZE: 10pt; FONT-FAMILY: Tahoma " >-- --Original
Message-- -- <BR > <B > <SPAN style= "FONT-WEIGHT: bold " >From: </SPAN > </B > David
Sharples [mailto:dsharples@(protected)] <BR > <B > <SPAN
style= "FONT-WEIGHT: bold " >Sent: </SPAN > </B > Wednesday, June 02, 2004 8:44
AM <BR > <B > <SPAN style= "FONT-WEIGHT: bold " >To: </SPAN > </B >
oracle-l@(protected) <BR > <B > <SPAN
style= "FONT-WEIGHT: bold " >Subject: </SPAN > </B > library cache
lock </SPAN > </FONT > <o:p > </o:p > </P >
<P > <FONT face=Arial size=2 > <SPAN lang=EN-GB
style= "FONT-SIZE: 10pt; FONT-FAMILY: Arial " > <!-- Converted from text/rtf format -- >Hi,
got a strange problem. I am trying to truncate a partition in a
table, but it just hangs forever, it is waiting on a library cache
lock. Anyone know why and how I can clear it </SPAN > </FONT > <SPAN
lang=EN-GB > </SPAN > <FONT face=Arial size=2 > <SPAN lang=EN-GB
style= "FONT-SIZE: 10pt; FONT-FAMILY: Arial " >– </SPAN > </FONT > <SPAN
lang=EN-GB > </SPAN > <FONT face=Arial size=2 > <SPAN lang=EN-GB
style= "FONT-SIZE: 10pt; FONT-FAMILY: Arial " >flushing the shared
pool </SPAN > </FONT > <SPAN lang=EN-GB > </SPAN > <FONT face=Arial size=2 > <SPAN
lang=EN-GB style= "FONT-SIZE: 10pt; FONT-FAMILY: Arial " >didn’t help and
there are no other sessions touching that
table. </SPAN > </FONT > <o:p > </o:p > </P >
<P > <FONT face=Arial size=2 > <SPAN lang=EN-GB
style= "FONT-SIZE: 10pt; FONT-FAMILY: Arial " >Thanks </SPAN > </FONT > <o:p > </o:p > </P >
<P > <FONT face=Arial size=2 > <SPAN lang=EN-GB
style= "FONT-SIZE: 10pt; FONT-FAMILY: Arial " >Dave </SPAN > </FONT > <o:p > </o:p > </P > </BLOCKQUOTE > </BLOCKQUOTE > </DIV > </BLOCKQUOTE > </BODY > </HTML >