Sie sind auf Seite 1von 9

Library cache lock and library cache pin waits Oracle database internals by Riyaj

Page 1 of 9

Oracle database internals by Riyaj


Discussions about Oracle performance tuning, RAC, Oracle internal & E-business suite.

Library cache lock and library cache pin waits


PostedbyRiyajShamsudeen onJune2,2009
I encounteredfewcustomerissuescenteredaroundlibrarycachelockandlibrarycachepinwaits.Librarycachelockandpinwaitscanhanginstance,andinfew
cases,wholeclustersofRACinstancescanbehungduetolibrarycachelockandpinwaits.
Why Library cache locks are needed?
LibrarycachelocksakaparselocksareneededtomaintaindependencymechanismbetweenobjectsandtheirdependentobjectslikeSQLetc.Forexample,ifanobject
definitionneedtobemodifiedorifparselocksaretobebroken,thendependentobjectsobjectsmustbeinvalidated.Thisdependencyismaintainedusinglibrary
cachelocks.Forexample,ifacolumnisdroppedfromatablethenallSQLsdependentuponthetablemustbeinvalidatedandreparsedduringnextaccesstothat
object.Librarycachelocksaredesignedtoimplementthistrackingmechanism.
Inaregularenqueuelockingscenariosthereisaresource(exampleTMtablelevellock)andsessionsenqueuetolockthatresource.Morediscussiononenqueue
lockingcanbefoundinInternaloflocks.Similarly,librarycachelocksusesobjecthandlesasresourcestructuresandlocksaretakenonthatresource.Iftheresources
arenotavailableinacompatiblemode,thensessionsmustwaitforlibrarycacheobjectstobeavailable.
Why Library cache pins are needed?
Librarycachepinsdealswithcurrentexecutionofdependentobjects.Forexample,anunderlyingobjectsshouldnotbemodifiedwhenasessionisexecutingor
accessingadependentobject.So,beforeparselocksonalibrarycacheobjectcanbebroken,librarycachepinsmustbeacquiredinanExclusivemodeandthenonly
librarycacheobjectscanbedropped.Ifasessionisexecutingastoredobject,thenthelibrarycachepinswillnotbeavailableandtherewillbewaitsforlibrarycache
pins.Typically,thishappensforalongrunningstatementexecutingastoredobject.
x$kgllk, x$kglpn and x$kglob
Librarycachelocksandpinsareexternalizedinthreex$tables.x$kgllkisexternalizingalllockingstructuresonanobject.Entriesinx$kglobactsasaresource
structure.x$kglpnisexternalizingalllibrarycachepins.
x$kglob.kglhdadractsasapointertotheresourcestructure.Presumably,kglhdadrstandsKGLhandleaddress.x$kgllkactsasalockstructureandx$kgllk.kgllkhdl
pointstox$kglob.kglhdadr.Also,x$kglpnactsasapinstuctureandx$kglpn.kglpnhdlpointstox$kglob.kglhdadrtopinaresource.Togiveananalogybetween
objectlockingscenarios,x$kglobactsasresourcestructureandx$kgllkactsaslockstructuresforlibrarycachelocks.Forlibrarycachepins,x$kglpnactsaspin
structure.x$kglpnalsopinsthatresourceusingkglpnhdl.Thismightbeclearafterreviewingtheexamplebelow.
Test case
Wewillcreateasimpletestcasetocreatelibrarycachelocksandpinwaits
create or replace procedure backup.test_kgllk (l_sleep in boolean , l_compile in boolean)
as
begin
if (l_sleep ) then
sys.dbms_lock.sleep(60);
elsif (l_compile ) then
execute immediate 'alter procedure test_kgllk compile';
end if;
end;
/

Inthistestcaseabove,wecreateaprocedureanditacceptstwobooleanparameters:sleepandcompile.Passingtruetofirstargumentwillenabletheprocedureto
sleepforaminuteandpassingtrueforthesecondargumentwillenabletheproceduretorecompileitself.
Letscreatetwosessionsinthedatabaseandthenexecutethemasbelow.
Session#1:exectest_kgllk(true,false); Sleepfor1minutesandnocompile
Session#2:exectest_kgllk(false,true); Nosleep,butcompile..
Atthispointbothsessionsarewaiting.FollowingSQLcanbeusedtoprintsessionwaitdetails.

http://orainternals.wordpress.com/2009/06/02/library-cache-lock-and-library-cache-pin-waits/

12/30/2013

Library cache lock and library cache pin waits Oracle database internals by Riyaj

Page 2 of 9

select
distinct
ses.ksusenum sid, ses.ksuseser serial#, ses.ksuudlna username,ses.ksuseunm machine,
ob.kglnaown obj_owner, ob.kglnaobj obj_name
,pn.kglpncnt pin_cnt, pn.kglpnmod pin_mode, pn.kglpnreq pin_req
, w.state, w.event, w.wait_Time, w.seconds_in_Wait
lk.kglnaobj, lk.user_name, lk.kgllksnm,
,lk.kgllkhdl,lk.kglhdpar
,trim(lk.kgllkcnt) lock_cnt, lk.kgllkmod lock_mode, lk.kgllkreq lock_req,
,lk.kgllkpns, lk.kgllkpnc,pn.kglpnhdl
from
x$kglpn pn, x$kglob ob,x$ksuse ses
, v$session_wait w
where pn.kglpnhdl in
(select kglpnhdl from x$kglpn where kglpnreq >0 )
and ob.kglhdadr = pn.kglpnhdl
and pn.kglpnuse = ses.addr
and w.sid = ses.indx
order by seconds_in_wait desc
/
OutputofaboveSQLis:
SID
SERIAL# USERNAME

268
12409 SYS
313
45572 SYS
313
45572 SYS

MACHINE

orap
orap
orap

OBJ_OWNER

SYS
SYS
SYS

OBJ_NAME

TEST_KGLLK
TEST_KGLLK
TEST_KGLLK

pin
cnt

3
0
3

pin
mode

2
0
2

pin
req

0
3
0

STATE

WAITING
WAITING
WAITING

wait seconds
EVENT
time in_wait

PL/SQL lock timer
0
7
library cache pin
0
3
library cache pin
0
3

1. Session268(session#1)issleepingwhileholdinglibrarycachepinontest_kgllkobject(waitingonPL/SQLlocktimermoreaccurately).
2. Session313isholdinglibrarycachepininmode2andwaitingforlibrarycachepininmode3.
Obviously,session313iswaitingforsession268toreleaselibrarycachepins.Sincesession268isexecuting,session313shouldnotbeallowedtomodifytest_kgllk
librarycacheobject.Thatsexactlywhylibrarycachepinsareneeded.
Adding another session to this mix..
Letsaddonemoresessionasbelow
exec test_kgllk (false, true);
Outputofabovequeryis:
SID
SERIAL# USERNAME

268
12409 SYS
313
45572 SYS
313
45572 SYS
442
4142 SYS

MACHINE

oraperf
oraperf
oraperf
oraperf

OBJ_OWNER

SYS
SYS
SYS
SYS

pin pin pin


OBJ_NAME
cnt mode req STATE

TEST_KGLLK
3
2
0 WAITING
TEST_KGLLK
0
0
3 WAITING
TEST_KGLLK
3
2
0 WAITING
TEST_KGLLK
0
0
2 WAITING

wai
EVENT

PL/SQL lock timer


library cache pin
library cache pin
library cache pin

Well,nosurprisethere.Newsession442alsowaitingforlibrarycachepin.But,noticetherequestmodeforsession442.Itis2.Session442needsthatlibrarycachepin
insharemodetostartexecution.But313hasalreadyrequestedthatlibrarycachepininmode3.Aqueueisbuildinguphere.Manyprocessescanqueuebehind
session313atthispointleadingtoanhunginstance.
library cache locks..
Letsexecutesamepackagebutbothwithsameparameters.
Session #1: exec test_kgllk(false, true);
Session #2: exec test_kgllk(false, true);
Rerunningabovequerytellsusthatsession313iswaitingfortheself.Eventually,thiswillleadlibrarycachepinselfdeadlock.
Library cache pin holders/waiters

SID
SERIAL# USERNAME

313
45572 SYS
313
45572 SYS

MACHINE

oraperf
oraperf

OBJ_OWNER

SYS
SYS

pin pin pin


OBJ_NAME
cnt mode req STATE

TEST_KGLLK
0
0
3 WAITING
TEST_KGLLK
3
2
0 WAITING

wai
EVENT

library cache pin


library cache pin

Wait,whathappenedtosession#2?Itisnotvisibleinx$kglpn.Queryingv$session_waitshowsthatSession#2iswaitingforlibrarycachelock.Wewillrunyet
anotherqueryagainstx$kgllktoseelibrarycachelockwaits.

http://orainternals.wordpress.com/2009/06/02/library-cache-lock-and-library-cache-pin-waits/

12/30/2013

Library cache lock and library cache pin waits Oracle database internals by Riyaj

Page 3 of 9

Querying x$kgllk with the query below:


select
distinct
ses.ksusenum sid, ses.ksuseser serial#, ses.ksuudlna username,KSUSEMNM module,
ob.kglnaown obj_owner, ob.kglnaobj obj_name
,lk.kgllkcnt lck_cnt, lk.kgllkmod lock_mode, lk.kgllkreq lock_req
, w.state, w.event, w.wait_Time, w.seconds_in_Wait
from
x$kgllk lk, x$kglob ob,x$ksuse ses
, v$session_wait w
where lk.kgllkhdl in
(select kgllkhdl from x$kgllk where kgllkreq >0 )
and ob.kglhdadr = lk.kgllkhdl
and lk.kgllkuse = ses.addr
and w.sid = ses.indx
order by seconds_in_wait desc
/
Library cache lock holders/waiters

SID
SERIAL# USERNAME

313
45572 SYS
313
45572 SYS
268
12409 SYS
268
12409 SYS

MODULE

wsqfinc1a
wsqfinc1a
wsqfinc1a
wsqfinc1a

lock lock
OBJ_NAME
LCK_CNT mode req STATE

TEST_KGLLK
1
1
0 WAITING
TEST_KGLLK
1
3
0 WAITING
TEST_KGLLK
0
0
2 WAITING
TEST_KGLLK
1
1
0 WAITING

OBJ_OWNER

SYS
SYS
SYS
SYS

wait se
EVENT

library cache pin


library cache pin
library cache lock
library cache lock

Session313isholdinglibrarycachelockonthatobjectinmode3andsession268isrequestinglockonthatlibrarycacheobjectinmode2.So,session268iswaitingfor
librarycachelockwhilesession313iswaitingforlibrarycachepin(self).Again,pointhereisthatsession268istryingtoaccesslibrarycacheobjectandneedto
acquirelibrarycachelockincorrectmode.Thatlibrarycachelockisnotavailableleadingtoawait.
Completescriptcanbedownloadedfrommyscriptarchive.
RAC, library cache locks and pins
ThingsaredifferentinRAC.LibrarycachelocksandpinsareglobalresourcescontrolledbyGESlayer.So,thesescriptsmightnotworkiftheselibrarycachelockand
pinwaitsareglobalevents.LetslookatwhathappensinaRACenvironment
exectest_kgllk(false,true); node1
exectest_kgllk(false,true); node2
Innode1,onlyonesessionisvisible.
Library cache pin holders/waiters

SID
SERIAL# USERNAME

268
12409 SYS
268
12409 SYS

MACHINE

oraperf
oraperf

OBJ_OWNER

SYS
SYS

pin pin pin


OBJ_NAME
cnt mode req STATE

TEST_KGLLK
0
0
3 WAITING
TEST_KGLLK
3
2
0 WAITING

wai
EVENT

library cache pin


library cache pin

In node 2, only requestor of the lock is visible.

lock lock
SID
SERIAL# USERNAME
MODULE
OBJ_OWNER OBJ_NAME
LCK_CNT mode req STATE
EVENT

377
43558 SYS
wsqfinc2a SYS
TEST_KGLLK
0
0
2 WAITING
library cache lock
Essentially,thisscriptdoesnotworkinaRACenvironmentsinceitaccessesx$tablesdirectly,whicharelocaltoaninstance.TounderstandtheissueinaRAC
environmentweneedtoaccessgv$views,basedonx$kgllk,x$kglpnetc.But,Idontseegv$viewsoverthesex$tables.Weareoutofluckthereunlesswedosome
morecoding.
Nevertheless,wecanseelockersandwaitersaccessinggv$ges_blocking_enqneuetounderstandlockinginRAC.
1 select inst_id, handle, grant_level, request_level, resource_name1, resource_name2, pid , transaction_id0, transaction_id1
2* ,owner_node, blocked, blocker, state from gv$ges_blocking_enqueue
SQL> /
INST_ID HANDLE
GRANT_LEV REQUEST_L RESOURCE_NAME1
RESOURCE_NAME2
PID

TRANSACTION_ID0 TRANSACTION_ID1 OWNER_NODE
BLOCKED
BLOCKER

STATE

2 00000008DD779258 KJUSERNL KJUSERPR [0x45993b44][0x3a1b9eee],[LB] 1167670084,974888686,LB


8700
0
0
1
1
0
OPENING
1 00000008E8123878 KJUSEREX
0
0

KJUSEREX
0

[0x45993b44][0x3a1b9eee],[LB]
0
1

1167670084,974888686,LB

12741

GRANTED

http://orainternals.wordpress.com/2009/06/02/library-cache-lock-and-library-cache-pin-waits/

12/30/2013

wait se

Library cache lock and library cache pin waits Oracle database internals by Riyaj

Page 4 of 9

WecanseethatPID12741frominstance1isholdingalibrarycachegloballock[LB].Globalresourceinthiscaseis[0x45993b44][0x3a1b9eee],[LB]whichuniquely
identifiesalibrarycacheobjectattheclusterlevel.Grant_levelisKJUSEREXorExclusivelevelandrequest_levelfromnode2isKJUSERPRwhichisProtectedRead
level.PID8700innode2iswaitingforlibrarycachelockheldbyPID12741innode1.Usingthisoutputandourscriptoutput,wecanpinpointwhichprocessis
holdinglibrarycachelockorpin.WhileLibrarycachelocksareglobalizedasgloballocksintherangeof[LA] [LZ],Librarycachepinsarealsoglobalizedaslock
typesintherange[NA][NZ].
Thisblogcanbereadinadocumentformatfrom
Library_cache_locks_and_library_cache_pin_waits
Update#1:Updatedbrokenlinks.
Update#2:Updatedverbatimafterareadercomment.
ThisentrywaspostedonJune2,2009at9:37pm andisfiledunderOracledatabaseinternals,Performancetuning. Tagged:gv$ges_blocking_enqueue,librarycache
lock,librarycachepin,oracleperformance,performance,x$kgllk,x$kglob,x$kglpn.YoucanfollowanyresponsestothisentrythroughtheRSS2.0 feed. Youcan
leavearesponse,ortrackback fromyourownsite.

31 Responses to Library cache lock and library cache pin waits

1.

Yasser said
June5,2009at12:07pm
Excellentarticle!!!!
Everymonthiusetowaitforyournewarticlescuriouslyonthisblog
Pleasekeeppostingarticles
Yasser
Reply

orainternals said
June7,2009at12:51am
ThankyouYasser.
Reply

2.

B. Polarski said
June19,2009at7:28am
Reallygoodarticle.Iappreciatealotthesmallfunctiontoprovokeanlock/pin.
Reply

orainternals said
June19,2009at2:26pm
Thankyou,Polarski.
Reply

3.

library_cache_lock and library_cache_pin Anand's Blog said


October4,2009at6:56pm
[...] http://orainternals.wordpress.com/2009/06/02/librarycachelockandlibrarycachepinwaits/ [...]
Reply

4.

Alberto Dell'Era said


November25,2009at2:31pm
I haveusedyourbrillianttestcasetodaytosuccessfullyinvestigateanastylibrarycachelockwaitingscenario.
Thankyouverymuchforsharingboththeknowledgeandthetestcase!
Alberto
Reply

orainternals said
November25,2009at4:12pm

http://orainternals.wordpress.com/2009/06/02/library-cache-lock-and-library-cache-pin-waits/

12/30/2013

Library cache lock and library cache pin waits Oracle database internals by Riyaj

Page 5 of 9

HiAlberto
Itisveryrefreshingandmotivatingtohearfromanexpertsuchasyou,Alberto.Iamabigfanofyourworkandyourbloghttp://www.adellera.it/blog.
Thankyouverymuch,
Cheers
Riyaj
Reply

5.

Rakesh said
December30,2009at6:36pm
Thanksorainternal.veryinformativearticle.
I alsodidasmalltestcaseonbasisofinformationprovidedhere.
Inmytestingscenario,when1stsession(blockersession)isdonewithitssleepsandcompleteitsexecution,eventhenothersessions(blockingsession)arewaiting
onLatchwaitevent.
Ithoughtothersessions(blockingsession)willcontinuetheirjobonce1stsession(blockersession)completesitsexecutionbutiguessiwaswrong.Dontknow
WHYandHOW.
Thattimewedoesntgetinformationabouttheblockersessionbutothersessionarestillwaiting/hang.
Inrealworldwecangetthissituationveryoftenandifwecantgetinformationabouttheblockersession,weactuallycantsolvetheissue.
I triedhanganalyzealsobutcouldntgettheinformationabouttheblockersessiononceitsgone.
Canyouputsomemoreinformationonhowtogettheblocker/culpritsessioneventhoughitsgoneorcompleteditsexecution.
Rakesh
Reply

orainternals said
December31,2009at3:55pm
Rakesh
Thanksforvisitingmyblog.SorryIdonthavemuchdetailsinyourcommenttodofurtheranalysis.
Canyouprovidemoreinformationsuchasoutputandscriptsetc?
Cheers
Riyaj
Reply

6.

Rakesh said
January1,2010at9:34pm
HIRiyaj
I didmytestingon10.2.0.1andmytestingwasexactlyasitismentionedonthisblog.
Session#1exectest_kgllk(false,true);
Session#2:exectest_kgllk(true,flase);
Session#3:exectest_kgllk(true,flase);
Whilesession#1wassleepingIexecutedbotthequeriesandgottheresultasexecptedandmentionedinblogbutafter2minuteswhensession#1wasdonewith
sleepingandcompleteditsexecutionInoticedother2sessionswerestillwaiting,soIexecutedthose2queriesagainandgotsurprisedtoknowthatboththe
sessionsarestillwaitingfortheLatchLibrarycachethoughnootheractivitywashappenningonthedatabase.
I hopethisinformationgivesumoredetailaboutmytestcase.
Rakesh
Reply

7.

Bala said
September16,2010at2:21pm
Hi,
Itisindeedagoodarticle.Thanksforit.
I haveaquestion(maybesilly).
Anexampleof,inoticedalibrarycachelockandihavecleareditbyidentifyingthesessioncausingthiseventandterminatedit(ofcoursewiththeconfirmation
thatthesessionisazombie).
Justgivenanotherthought,willflushingsharepoolwillclearthelibrarycachelocks?
Amlookingforsomeconfirmation.
Thanksinadvance.
Bala

http://orainternals.wordpress.com/2009/06/02/library-cache-lock-and-library-cache-pin-waits/

12/30/2013

Library cache lock and library cache pin waits Oracle database internals by Riyaj

Page 6 of 9

Reply

orainternals said
September27,2010at5:56pm
HelloBala
Thanksforreadingmyblog.No,flushsharedpoolwillnotclearit.Flushingclearsunpinnedrecreatablechunks.Pinnedobjectsarenotflushed.
Cheers
Riyaj
Reply

8.

Hans-Peter said
March22,2011at1:53pm
HiRiyaj,
I hadalibrarycachelockissueonanExadatamachine.
Strangeenoughthepidgiveninthequeryfurtherbelowcouldnotberelatedtothepidcolumninv$process.
regardsHanspeter
selectinst_id,handle,grant_level,request_level,resource_name1,resource_name2,pid,transaction_id0,transaction_id1
,owner_node,blocked,blocker,statefromgv$ges_blocking_enqueue
SQL>/
INST_IDHANDLEGRANT_LEVREQUEST_LRESOURCE_NAME1RESOURCE_NAME2PIDTRANSACTION_ID0

TRANSACTION_ID1OWNER_NODEBLOCKEDBLOCKERSTATE

3000000034B5A27E0KJUSEREXKJUSEREX[0x815044d][0x3d81e70],[LB]135595085,64495216,LB53246946819
7702201GRANTED
3 0000000349004C40KJUSERNLKJUSEREX[0x19][0x2],[RS]25,2,RS163710
0210OPENING
1 00000003494E5BF0KJUSERNLKJUSERPR[0x815044d][0x3d81e70],[LB]135595085,64495216,LB223037208961
1554010OPENING
1 000000034D5ECF90KJUSERNLKJUSEREX[0x19][0x2],[RS]25,2,RS70190
0010OPENING
2 0000000349004C40KJUSERNLKJUSEREX[0x19][0x2],[RS]25,2,RS59020
0110OPENING
4 0000000349004C40KJUSEREXKJUSEREX[0x19][0x2],[RS]25,2,RS24319 0
0301GRANTED
6 rowsselected.
Reply

9.

sriram Sanka said


April15,2011at12:49pm
ExcellentOneveryhelpful!
Reply

10.

Eloy said
May23,2011at4:38pm
ExcelentRiyaj.Thanksalottopublicthosescripts.
Reply

11.

Kamus said
July12,2011at10:00am
Thankyouverymuchforsharingthisarticle.Veryuseful.
Reply

12.

Vikram Sharma said


December2,2011at2:40am

http://orainternals.wordpress.com/2009/06/02/library-cache-lock-and-library-cache-pin-waits/

12/30/2013

Library cache lock and library cache pin waits Oracle database internals by Riyaj

Page 7 of 9

HiRiyaz.
I triedasimilartestin11.2.0.2versionenc.Icreatedasimpleprocwithaninfiniteloop;
createorreplaceprocedureinfil
as
loop_idxNUMBER:=0;
begin
LOOP
loop_idx:=loop_idx+1;
ENDLOOP;
end;
Thendidthefollowing
Session212;execinfil;
session62:alterprocedureinfilcompile;
sessoin114;execinfil;
A queryonpinwaitsrevealedthefollowing.
SYS@db102DEC201102:28:09>/
SIDSERIAL#USERNAMEMACHINEOBJ_OWNEROBJ_NAMEPIN_CNTPIN_MODEPIN_REQSTATEEVENTWAIT_TIMELOCK_REQ


21238797SYSSYSINFIL320WAITEDKNOWNTIMESQL*Netmessagefromclient16263439
6258589SYSSYSINFIL003WAITINGlibrarycachepin0260
11418227SYSSYSINFIL002WAITINGlibrarycachepin02
However,Iamunabletoexplainthis.Aftersometimesession114acquiredthepin.
SYS@db102DEC201102:28:45>/
SIDSERIAL#USERNAMEMACHINEOBJ_OWNEROBJ_NAMEPIN_CNTPIN_MODEPIN_REQSTATEEVENTWAIT_TIMELOCK_REQ


21238797SYSSYSINFIL320WAITEDKNOWNTIMESQL*Netmessagefromclient16263441
6258589SYSSYSINFIL003WAITINGlibrarycachepin0262
11418227SYSSYSINFIL320WAITEDKNOWNTIMElibrarycachepin3004
Hassomethingchangedin11g.
Alsohowcanwecheckthenamespacein11gfromp3parameters.In10gitwas100*namespace+mode.
In11giseethisinmyp3(272876452249603).IbelieveIcanstilllookatthelastdigitformode(hereits3).
SIDSTATUSSQL_IDPROGRAMMACHINEWAIT_CLASSUSERNAMEEVENTSTATE


P1P2P3P1RAWP2RAWBSIDBSTATUSwaitsobj#file#block#ROW#

62ACTIVE8g07j11zxs7xwsqlplus@db1(TNSV1V3)db1ConcurrencySYSlibrarycachepinWAITING
5.0440E+175.0440E+17272876452249603070000002CF5DA00070000003EB04310114VALID5721000
Reply

orainternals said
December12,2011at10:13am
I needtoreviewthisfurther.Sorryfornotreplyingpromptly.
Reply

13.

Naresh said
March13,2012at9:19am
HelloRiyaj,
Yourinternalsoflockslinkisnotaccessible canyoukindlycorrect?Thankyouforyourreallygoodarticles.
Naresh
Reply

14.

Nishtha said
May22,2012at1:13pm
ButhowdoIgetridoftheselibrarycachepins?OneofmyDevelopmentserverswhichisa2NodeRACgivesthisissueveryoften,andIhadtokeepkillingthe
sessionsthatgetsblockedduetodeadlocks.isthattheonlysolution?
Reply

http://orainternals.wordpress.com/2009/06/02/library-cache-lock-and-library-cache-pin-waits/

12/30/2013

Library cache lock and library cache pin waits Oracle database internals by Riyaj

Page 8 of 9

Riyaj Shamsudeen said


May22,2012at6:28pm
HelloNishta
Didyoumeanttosaylibrarycachepins?ordeadlocksduetolibrarycachepin?Iamgoingtoassumethattherearenodeadlocksandreply.
Withoutlookingatdetails,Iwouldguessthatyourdevelopersareexecutingsomestoredobject,thentryingtorecompiletheobject(maybe,theirfixdidnt
work).
Pleasegothroughmyblogandprinttheoutputofthescriptsintheblog.Maybe,Icanreviewdetailsandhelpyou.
Ifthisisadeadlock,thenIwouldneedadeadlocktracefiletounderstandtheissue.
Thanks
Riyaj
Reply

15.

Artem Gorbyk said


June26,2012at9:05am
HelloRiyaj,
Manythanksforthegreatarticle!
Imtryingyourlibrarycachelockexampleandlookslikein11.2RACtheselfdeadlock(whenyoucompilesyourprocedurefrominsidethesameprocedure)is
nowautodetectedandtheORA04020:deadlockdetectedwhiletryingtolockobjectexceptionisthrown.MaybebecauseinRACitsaglobalresourceandsince
11.2theyaddedcheckstodetectthiskindofdeadlocks.
In10.2RACand11.2singleinstanceitworksexactlylikeyouexplained thesessionhangstryingtocompiletheprocedurewhileexecutingitandx$kglpnshows
tworowsforthesamesession.
Reply

16.

Christoph Ruepprich said


November9,2012at8:23pm
RebloggedthisonChristophs2OracleCents andcommented:
Icameaccross100%librarycachepinwaits,whiletryingtocompileaprocedurewhichwascurrentlyexecuting.
Afteralittleresearch,IcameacrossthisfantasticarticlebyRiyajShamsudeen.
Reply

17.

sam said
December5,2012at7:39am
HiRiyaj,
Theabovefroma2nodeprodRAC;
INST_ID HANDLE GRANT_LEVEL REQUEST_LEVEL RESOURCE_NAME1 RESOURCE_NAME2 PID TRANSACTION_ID0 TRANSACTION_ID1
OWNER_NODE BLOCKED BLOCKER STATE
1 C0000001BB9A3B40 KJUSEREX KJUSEREX [0x19][0x2],[RS] 25,2,RS 1313 0 0 0 0 1 GRANTED
2 C0000001BB9A3C90 KJUSERNL KJUSEREX [0x19][0x2],[RS] 25,2,RS 20612 0 0 1 1 0 OPENING
bothpointingtoCKPTbackgroundprocessofnode1blockingnode2;whatisthereasonforthis?
Also;isthereascripttoidentifythesessionaswellinthesamequery?
Thanks.
Reply

18.

VJ said
February1,2013at8:29pm
Excellentarticleandwellarticulated.Ifoundittobeextremelyuseful.Thanksabunch!!!!
Reply

19.

lytton said
February8,2013at9:33am
Didthelibrarycachelockhasanyrelationwithdadabaseforcelogging?
Reply

20.

Mohammed said
March7,2013at10:12pm

http://orainternals.wordpress.com/2009/06/02/library-cache-lock-and-library-cache-pin-waits/

12/30/2013

Library cache lock and library cache pin waits Oracle database internals by Riyaj

Page 9 of 9

RebloggedthisonAppsDBAnotes.
Reply

21.

Andrew Brennan said


April16,2013at9:23am
Hi,
Thanksverymuchforthisarticle.Ijustfixedamajorfaultonaproductionenvironmentwithyoursolution,avoidinganunneccessarydatabasebounceand
furtherinterruptiontoservice.
Andy
2ndlineSupportDBAatBT
Reply

22.

rhys said
November1,2013at4:33pm
hi,
Thanksverymuchforthisarticle.ButIhaveaquestion,yousaidthatLibrarycachepinsdealswithcurrentexecutionofdependentobjects.Forexample,an
underlyingobjectsshouldnotbemodifiedwhenasessionisexecutingoraccessingadependentobject(SQL).So,beforeparselocksonalibrarycacheobjectcanbe
broken,librarycachepinsmustbeacquiredinExclusivemodeandthenonlylibrarycacheobjectscanbedropped.IfasessionisexecutinganSQL,thenlibrary
cachepinswillnotbeavailableandtherewillbewaitsforlibrarycachepins.Typically,thishappensforlongrunningSQLstatement.
ifIperformaselectqueryatable,andthenicandropthistableinanothersession,sowhydoicandropthetable?
Reply

Riyaj Shamsudeen said


November1,2013at5:13pm
Hellorhys
Goodquestion.Iupdatedverbatimtospecifystoredobject.But,toansweryourquestionspecifically,IfIrecallcorrectly,librarycachepinsaredowngradedto
nullmodeafterthestartofcursorfetchoperation.Thatswhyyoucandropthetableinanothersessionwhilefetchingthroughacursor.However,youcanget
objectnolongerexistsifthefetchcontinuesbeyondafterthedropstatement.
Cheers
Riyaj
Reply

23.

Mahadev said
December18,2013at11:45am
Hi,cananyonetellmetohowtoremovethecacheLibrarylockfromdatabase
Reply

COLLABORATE2009presentation:11gperformancenewfeature.
Resolvingcorruptionissuewithfile_hdrsdump

BlogatWordPress.com.|CustomizedAndreas09Theme.
Follow

Follow Oracle database internals by Riyaj


PoweredbyWordPress.com

http://orainternals.wordpress.com/2009/06/02/library-cache-lock-and-library-cache-pin-waits/

12/30/2013

Das könnte Ihnen auch gefallen