library cahce pin

9679 ワード

 library cahce pin(     pin)               ,                

               。      (pin)                。

          PL/SQL      ,Oracle     。

library cache pin library cache lock    hard parse



create or replace procedure test_prc as
begin
insert into test1 select * from test1;
end;

SESSION SID=1        ,

SESSION SID=36      

SQL> select sid,event from v$session_wait where event not like '%message%';

       SID EVENT
---------- ----------------------------------------------------------------
	 1 db file scattered read
	 2 pmon timer
	 3 VKTM Logical Idle Wait
	 5 DIAG idle wait
	 8 DIAG idle wait
	10 db file async I/O submit
	12 log file parallel write
	13 smon timer
	18 Streams AQ: qmn coordinator idle wait
	26 Streams AQ: qmn slave idle wait
	28 Space Manager: slave idle wait

       SID EVENT
---------- ----------------------------------------------------------------
	32 Streams AQ: waiting for time management or cleanup tasks
	36 library cache pin
	37 Data file init write

14 rows selected.


SQL> col name format a30
SQL> select SESSION_ID,NAME,P1,P2,P3,WAIT_TIME,CURRENT_OBJ#,CURRENT_FILE#,CURRENT_BLOCK#
          from v$active_session_history ash, v$event_name enm
          where ash.event#=enm.event#
           and SESSION_ID=36;   2    3    4  

SESSION_ID NAME 				  P1	     P2 	P3  WAIT_TIME CURRENT_OBJ# CURRENT_FILE# CURRENT_BLOCK#
---------- ------------------------------ ---------- ---------- ---------- ---------- ------------ ------------- --------------
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139

SESSION_ID NAME 				  P1	     P2 	P3  WAIT_TIME CURRENT_OBJ# CURRENT_FILE# CURRENT_BLOCK#
---------- ------------------------------ ---------- ---------- ---------- ---------- ------------ ------------- --------------
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139
	36 library cache pin		   737880368  737837676      65539	    0	       236	       1	 102139


SQL> SQL> select name, PARAMETER1,PARAMETER2,PARAMETER3 from v$event_name where name='library cache pin';

NAME			       PARAMETER1	    PARAMETER2		 PARAMETER3
------------------------------ -------------------- -------------------- ------------------------------
library cache pin	       handle address	    pin address 	 100*mode+namespace


--    V$SESSION_WAIT      ”library cache pin” session
SQL> SELECT sid,
       SUBSTR (event, 1, 30),
       TO_CHAR(p1, 'xxxxxxxx') p1_16,
       --P1RAW P1_16,
       p2,
       p3
  FROM v$session_wait
 WHERE wait_time = 0 AND event LIKE 'library cache pin%';  2    3    4    5    6    7    8  

       SID SUBSTR(EVENT,1,30)						P1_16		  P2	     P3
---------- ------------------------------------------------------------ --------- ---------- ----------
	36 library cache pin						 2bfb2930  737458808 3.3599E+14



--    DBA_LOCK_INTERNAL V$SESSION_WAIT,    ”library cache pin”      object   
SQL> SELECT TO_CHAR (SESSION_ID, '999') sid,
       SUBSTR (LOCK_TYPE, 1, 30) TYPE,
       SUBSTR (lock_id1, 1, 23) Object_Name,
       SUBSTR (mode_held, 1, 4) HELD,
       SUBSTR (mode_requested, 1, 4) REQ,
       lock_id2 Lock_addr
  FROM dba_lock_internal
 WHERE mode_requested <> 'None' AND mode_requested <> mode_held
       AND session_id IN
              (SELECT sid
                 FROM v$session_wait
                WHERE wait_time = 0 AND event LIKE 'library cache pin%');
                   2    3    4    5    6    7    8    9   10   11   12  ;

SID  TYPE							  OBJECT_NAME					 HELD	  REQ	   LOCK_ADDR
---- ------------------------------------------------------------ ---------------------------------------------- -------- -------- -------------------------

---------------
  36 Table/Procedure/Type Definitio				  TEST.TEST_PRC 				 None	  Excl	   2BFB2930



SQL> SQL>  select sid, P1RAW,P1TEXT ,event from v$session_wait where event not like '%message%';

       SID P1RAW	    P1TEXT			   EVENT
---------- ---------------- ------------------------------ ----------------------------------------------------------------
	 1 0000000000000004 file#			   db file scattered read
	 2 0000000000000100 duration			   pmon timer
	 3 00						   VKTM Logical Idle Wait
	 5 0000000000000005 component			   DIAG idle wait
	 8 0000000000000005 component			   DIAG idle wait
	10 000000000000077A requests			   db file async I/O submit
	12 0000000000000001 files			   log file parallel write
	13 000000000000012C sleep time			   smon timer
	18 00						   Streams AQ: qmn coordinator idle wait
	26 0000000000000001 Type			   Streams AQ: qmn slave idle wait
	28 0000000000000001 Slave ID			   Space Manager: slave idle wait

       SID P1RAW	    P1TEXT			   EVENT
---------- ---------------- ------------------------------ ----------------------------------------------------------------
	32 00						   Streams AQ: waiting for time management or cleanup tasks
	36 000000002BFB2930 handle address		   library cache pin
	37 00		    Slave ID			   Space Manager: slave idle wait

14 rows selected.



SELECT s.sid, kglpnmod "Mode", kglpnreq "Req",p.kglpnhdl
    FROM x$kglpn p, v$session s 
    WHERE p.kglpnuse=s.saddr
    AND kglpnhdl='&P1RAW'


SQL> SELECT s.sid, kglpnmod "Mode", kglpnreq "Req",p.kglpnhdl
    FROM x$kglpn p, v$session s 
    WHERE p.kglpnuse=s.saddr  2    3  ;

       SID	 Mode	     Req KGLPNHDL
---------- ---------- ---------- --------
	36	    0	       3 2BFB2930
	 1	    2	       0 2BFB2930

   kglpnhdl=p1_16


       SID SUBSTR(EVENT,1,30)						P1_16		  P2	     P3
---------- ------------------------------------------------------------ --------- ---------- ----------
	36 library cache pin						 2bfb2930  737458808 3.3599E+14



000000002BFB2930 16    2BFB2930    10    737880368