[20171107]dbms_shared_pool.pin.txt

来源:http://www.cnblogs.com/lfree/archive/2017/11/07/7799890.html
-Advertisement-
Play Games

[20171107]dbms_shared_pool.pin.txt--//昨天與別人聊天提到,如果dbms_shared_pool.pin對象,可以改變對應的chunk的類型.我自己也不確定,做一次測試.1.環境:SCOTT@book> @ &r/ver1PORT_STRING VERSION B ...


[20171107]dbms_shared_pool.pin.txt

--//昨天與別人聊天提到,如果dbms_shared_pool.pin對象,可以改變對應的chunk的類型.我自己也不確定,做一次測試.

1.環境:
SCOTT@book> @ &r/ver1

PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SCOTT@book> create sequence seq2 order;
Sequence created.

SCOTT@book> select * from dba_sequences where sequence_name = 'SEQ2' and sequence_owner=user;
SEQUENCE_OWNER                 SEQUENCE_NAME                   MIN_VALUE  MAX_VALUE INCREMENT_BY C O CACHE_SIZE LAST_NUMBER
------------------------------ ------------------------------ ---------- ---------- ------------ - - ---------- -----------
SCOTT                          SEQ2                                    1 1.0000E+28            1 N Y         20           1

SCOTT@book> select seq2.nextval from dual;
   NEXTVAL
----------
         1

SCOTT@book> select seq2.nextval from dual;
   NEXTVAL
----------
         2

SCOTT@book> alter system flush shared_pool;
System altered.

SCOTT@book> select seq2.nextval from dual;
   NEXTVAL
----------
        21

--//可以發現如果我刷新共用池,seq2順序號出現跳號現象.

2.測試前檢查seq2 chunk狀態:
select  * from x$kglob a where kglobtyd='SEQUENCE' and kglnaobj='SEQ2';

Record View
As of: 2017/11/7 11:22:41

ADDR:       00007F8F5EE5FA90
INDX:       942
INST_ID:    1
KGLHDADR:   000000007B988D28
KGLHDPAR:   000000007B988D28
KGLHDCLT:   119696
KGLNAOWN:   SCOTT
KGLNAOBJ:   SEQ2
KGLFNOBJ:   SEQ2
KGLNADLK:   
KGLNAHSH:   3497251728
KGLNAHSV:   8ab86e9923d83e59d93da6ffd073d390
KGLNATIM:   2017/11/7 11:19:42
KGLNAPTM:   2017/11/7 11:01:22
KGLHDNSP:   1
KGLHDNSD:   TABLE/PROCEDURE
KGLHDLMD:   1
KGLHDPMD:   0
KGLHDFLG:   10241
KGLHDOBJ:   000000007C9107A0
KGLHDLDC:   5
KGLHDIVC:   0
KGLHDEXC:   0
KGLHDLKC:   2
KGLHDKMK:   0
~~~~~~~~~~~~~~
KGLHDDMK:   1
KGLHDAMK:   0
KGLOBFLG:   4
KGLOBSTA:   1
KGLOBTYP:   6
KGLOBTYD:   SEQUENCE
KGLOBHMK:   0
KGLOBHS0:   4728
KGLOBHS1:   0
KGLOBHS2:   0
KGLOBHS3:   0
KGLOBHS4:   0
KGLOBHS5:   0
KGLOBHS6:   0
KGLOBHS7:   0
KGLOBHD0:   000000007BDC2F80
KGLOBHD1:   00
KGLOBHD2:   00
KGLOBHD3:   00
KGLOBHD4:   00
KGLOBHD5:   00
KGLOBHD6:   00
KGLOBHD7:   00
KGLOBPC0:   0
KGLOBPC6:   0
KGLOBTP0:   00
KGLOBT00:   5
KGLOBT01:   0
KGLOBT02:   0
KGLOBT03:   
KGLOBT04:   0
KGLOBT05:   0
KGLOBT35:   0
KGLOBT06:   0
KGLOBT07:   0
KGLOBT08:   90561
KGLOBT09:   10
KGLOBT10:   0
KGLOBT11:   1
KGLOBT12:   0
KGLOBT13:   0
KGLOBT14:   0
KGLOBT15:   0
KGLOBT16:   0
KGLOBT17:   0
KGLOBT18:   0
KGLOBT19:   0
KGLOBT20:   0
KGLOBT21:   0
KGLOBT22:   0
KGLOBT23:   9
KGLOBT24:   16
KGLOBT25:   0
KGLOBT26:   0
KGLOBT28:   0
KGLOBT29:   0
KGLOBT30:   0
KGLOBT31:   0
KGLOBT27:   0
KGLOBT32:   0
KGLOBT33:   0
KGLOBWAP:   0
KGLOBWCC:   0
KGLOBWCL:   0
KGLOBWUI:   0
KGLOBWDW:   0
KGLOBT42:   0
KGLOBT43:   0
KGLOBT44:   0
KGLOBT45:   0
KGLOBT46:   0
KGLOBT47:   0
KGLOBT49:   0
KGLOBT50:   0
KGLOBT52:   0
KGLOBT53:   0
KGLOBTL0:   0
KGLOBTL1:   0
KGLOBTS0:   
KGLOBTS1:   
KGLOBTN0:   22
KGLOBTN1:   1
KGLOBTN2:   1
KGLOBTN3:   9999999999999999999999999999
KGLOBTN4:   20
KGLOBTN5:   41
KGLOBTS2:   
KGLOBTS3:   
KGLOBTS5:   
KGLOBTT0:   
KGLOBCCE:   
KGLOBCCEH:  0
KGLOBCLA:   
KGLOBCLC:   0
KGLOBCCC:   0
KGLOBTS4:   
KGLOBCBCA:  
KGLOBT48:   0
KGLOBDSO:   0
KGLOBDEX:   0
KGLOBDPX:   0
KGLOBDLD:   0
KGLOBDIV:   0
KGLOBDPS:   0
KGLOBDDR:   0
KGLOBDDW:   0
KGLOBDBF:   0
KGLOBDRO:   0
KGLOBDCP:   0
KGLOBDEL:   0
KGLOBDFT:   0
KGLOBDEF:   0
KGLOBDUI:   0
KGLOBDCL:   0
KGLOBDAP:   0
KGLOBDCC:   0
KGLOBDPL:   0
KGLOBDJV:   0
KGLOBACS:   0
KGLOBTS6:   
KGLOBTS7:   
KGLOBT54:   0
KGLOBT55:   0
KGLOBT56:   0
KGLOBT57:   0
KGLOBDCO:   0
KGLOBDCI:   0
KGLOBDRR:   0
KGLOBDRB:   0
KGLOBDWR:   0
KGLOBDWB:   0
KGLOBT58:   0
KGLOBDOR:   0
KGLHDMTX:   000000007B988E68
KGLHDMVL:   0
KGLHDMSP:   0
KGLHDMGT:   110
KGLHDDMTX:  000000007B988DD8
KGLHDDVL:   0
KGLHDDSP:   0
KGLHDDGT:   8
KGLHDBID:   119696
KGLHDBMTX:  0000000080FE6278
KGLHDBVL:   0
KGLHDBSP:   0
KGLHDBGT:   20
KGLOBT59:   0
KGLOBDCU:   0
KGLOBPROP:  

--//註意: KGLHDADR:   000000007B988D28 KGLHDPAR:   000000007B988D28

SYS@book> @ &r/sharepool/shp4 000000007B988D28 0
old  18:  WHERE kglobt03 = '&1'  or kglhdpar='&1' or kglhdadr='&1' or KGLNAHSH= &2
new  18:  WHERE kglobt03 = '000000007B988D28'  or kglhdpar='000000007B988D28' or kglhdadr='000000007B988D28' or KGLNAHSH= 0
TEXT           KGLHDADR         KGLHDPAR         C40   KGLHDIVC KGLOBHD0         KGLOBHD6           KGLOBHS0   KGLOBHS6   KGLOBT16   N0_6_16        N20   KGLNAHSH KGLOBT03        KGLOBT09
-------------- ---------------- ---------------- ----- -------- ---------------- ---------------- ---------- ---------- ---------- --------- ---------- ---------- ------------- ----------
父游標句柄地址 000000007B988D28 000000007B988D28 SEQ2         0 000000007BDC2F80 00                     4728          0          0      4728       4728 3497251728                       10

--//順序號僅僅存在堆0(KGLOBHD0).沒有堆6.

SELECT * FROM x$ksmsp WHERE TO_NUMBER ('000000007B988D28', 'xxxxxxxxxxxxxxxx') between TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx') and TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx')+KSMCHSIZ
old   1: SELECT * FROM x$ksmsp WHERE TO_NUMBER ('&&1', 'xxxxxxxxxxxxxxxx') between TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx') and TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx')+KSMCHSIZ
new   1: SELECT * FROM x$ksmsp WHERE TO_NUMBER ('000000007B988D28', 'xxxxxxxxxxxxxxxx') between TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx') and TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx')+KSMCHSIZ
ADDR                   INDX    INST_ID   KSMCHIDX   KSMCHDUR KSMCHCOM         KSMCHPTR           KSMCHSIZ KSMCHCLS   KSMCHTYP KSMCHPAR
---------------- ---------- ---------- ---------- ---------- ---------------- ---------------- ---------- -------- ---------- ----------------
00007FFA00570A00       6932          1          1          1 KGLHD            000000007B988CF8        544 recr             80 00

--//註意KSMCHCLS=recr.

select a.* from x$ksmsp a where a.ksmchpar=hextoraw('000000007BDC2F80')
old   1: select a.* from x$ksmsp a where a.ksmchpar=hextoraw('&&1')
new   1: select a.* from x$ksmsp a where a.ksmchpar=hextoraw('000000007BDC2F80')
ADDR                   INDX    INST_ID   KSMCHIDX   KSMCHDUR KSMCHCOM         KSMCHPTR           KSMCHSIZ KSMCHCLS   KSMCHTYP KSMCHPAR
---------------- ---------- ---------- ---------- ---------- ---------------- ---------------- ---------- -------- ---------- ----------------
00007FFA005C3158       5052          1          1          1 KGLH0^d073d390   000000007C9106F0       4096 recr           4095 000000007BDC2F80

SELECT * FROM x$ksmsp WHERE TO_NUMBER ('000000007BDC2F80', 'xxxxxxxxxxxxxxxx') between TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx') and TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx')+KSMCHSIZ
old   1: SELECT * FROM x$ksmsp WHERE TO_NUMBER ('&&1', 'xxxxxxxxxxxxxxxx') between TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx') and TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx')+KSMCHSIZ
new   1: SELECT * FROM x$ksmsp WHERE TO_NUMBER ('000000007BDC2F80', 'xxxxxxxxxxxxxxxx') between TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx') and TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx')+KSMCHSIZ
ADDR                   INDX    INST_ID   KSMCHIDX   KSMCHDUR KSMCHCOM         KSMCHPTR           KSMCHSIZ KSMCHCLS   KSMCHTYP KSMCHPAR
---------------- ---------- ---------- ---------- ---------- ---------------- ---------------- ---------- -------- ---------- ----------------
00007FFA0059B0F0       6077          1          1          1 KGLDA            000000007BDC2F18        240 freeabl           0 00

--//僅僅存在2種類型chunk:recr ,freeabl.

3.測試keep pin後seq2狀態:

SYS@book> exec dbms_shared_pool.keep('SCOTT.SEQ2','Q');
PL/SQL procedure successfully completed.

SCOTT@book> select seq2.nextval from dual;
   NEXTVAL
----------
        22

SCOTT@book> alter system flush shared_pool;
System altered.

SCOTT@book> alter system flush shared_pool;
System altered.

SCOTT@book> select seq2.nextval from dual;
   NEXTVAL
----------
        23

--//可以發現keep後.seq2不會出現跳號情況.也就是刷新共用池seq2的chunk不會清除從共用池.
SYS@book> @ &r/sharepool/shp4 000000007B988D28 0
old  18:  WHERE kglobt03 = '&1'  or kglhdpar='&1' or kglhdadr='&1' or KGLNAHSH= &2
new  18:  WHERE kglobt03 = '000000007B988D28'  or kglhdpar='000000007B988D28' or kglhdadr='000000007B988D28' or KGLNAHSH= 0
TEXT           KGLHDADR         KGLHDPAR         C40   KGLHDIVC KGLOBHD0         KGLOBHD6           KGLOBHS0   KGLOBHS6   KGLOBT16   N0_6_16        N20   KGLNAHSH KGLOBT03        KGLOBT09
-------------- ---------------- ---------------- -------------- ---------------- ---------------- ---------- ---------- ---------- --------- ---------- ---------- ------------- ----------
父游標句柄地址 000000007B988D28 000000007B988D28 SEQ2         0 000000007BDC2F80 00                     4728          0          0      4728       4728 3497251728                       10

--//順序號僅僅存在堆0(KGLOBHD0).沒有堆6.
SELECT * FROM x$ksmsp WHERE TO_NUMBER ('000000007B988D28', 'xxxxxxxxxxxxxxxx') between TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx') and TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx')+KSMCHSIZ

old   1: SELECT * FROM x$ksmsp WHERE TO_NUMBER ('&&1', 'xxxxxxxxxxxxxxxx') between TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx') and TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx')+KSMCHSIZ
new   1: SELECT * FROM x$ksmsp WHERE TO_NUMBER ('000000007B988D28', 'xxxxxxxxxxxxxxxx') between TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx') and TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx')+KSMCHSIZ
ADDR                   INDX    INST_ID   KSMCHIDX   KSMCHDUR KSMCHCOM         KSMCHPTR           KSMCHSIZ KSMCHCLS   KSMCHTYP KSMCHPAR
---------------- ---------- ---------- ---------- ---------- ---------------- ---------------- ---------- -------- ---------- ----------------
00007FFA00571A70       5131          1          1          1 KGLHD            000000007B988CF8        544 recr             80 00

--//註意KSMCHCLS=recr.
old   1: select a.* from x$ksmsp a where a.ksmchpar=hextoraw('&&1')
new   1: select a.* from x$ksmsp a where a.ksmchpar=hextoraw('000000007BDC2F80')
ADDR                   INDX    INST_ID   KSMCHIDX   KSMCHDUR KSMCHCOM         KSMCHPTR           KSMCHSIZ KSMCHCLS   KSMCHTYP KSMCHPAR
---------------- ---------- ---------- ---------- ---------- ---------------- ---------------- ---------- -------- ---------- ----------------
00007FFA005B2560       3846          1          1          1 KGLH0^d073d390   000000007C9106F0       4096 recr           4095 000000007BDC2F80

SELECT * FROM x$ksmsp WHERE TO_NUMBER ('000000007BDC2F80', 'xxxxxxxxxxxxxxxx') between TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx') and TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx')+KSMCHSIZ
old   1: SELECT * FROM x$ksmsp WHERE TO_NUMBER ('&&1', 'xxxxxxxxxxxxxxxx') between TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx') and TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx')+KSMCHSIZ
new   1: SELECT * FROM x$ksmsp WHERE TO_NUMBER ('000000007BDC2F80', 'xxxxxxxxxxxxxxxx') between TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx') and TO_NUMBER(KSMCHPTR, 'xxxxxxxxxxxxxxxx')+KSMCHSIZ
ADDR                   INDX    INST_ID   KSMCHIDX   KSMCHDUR KSMCHCOM         KSMCHPTR           KSMCHSIZ KSMCHCLS   KSMCHTYP KSMCHPAR
---------------- ---------- ---------- ---------- ---------- ---------------- ---------------- ---------- -------- ---------- ----------------
00007FFA005A2610       4548          1          1          1 KGLDA            000000007BDC2F18        240 freeabl           0 00

--//很明顯並不是想對方講的那樣chunk的類型發生了變化,還是與原來的一樣.

SELECT OWNER
      ,NAME
      ,DB_LINK
      ,NAMESPACE
      ,TYPE
      ,SHARABLE_MEM
      ,LOADS
      ,EXECUTIONS
      ,LOCKS
      ,PINS
      ,KEPT
  FROM V$DB_OBJECT_CACHE
 WHERE name = 'SEQ2' AND owner = 'SCOTT';

OWNER  NAME  DB_LINK  NAMESPACE       TYPE     SHARABLE_MEM      LOADS EXECUTIONS      LOCKS       PINS KEP
------ ----- -------- --------------- -------- ------------ ---------- ---------- ---------- ---------- ---
SCOTT  SEQ2           TABLE/PROCEDURE SEQUENCE         4728          5          0          2          0 YES

--//猜測KEEP欄位有關.看看底層定義:

SYS@book> select * from V$FIXED_VIEW_DEFINITION where view_name='GV$DB_OBJECT_CACHE' ;
VIEW_NAME                      VIEW_DEFINITION
------------------------------ ----------------------------------------------------------------------------------------------------
GV$DB_OBJECT_CACHE             select inst_id,kglnaown,kglnaobj,kglnadlk,kglhdnsd,kglobtyd, kglobhs0+kglobhs1+kglobhs2+kglobhs3+kgl
                               obhs4+kglobhs5+kglobhs6, kglhdldc,kglhdexc,kglhdlkc,kglobpc0,decode(kglhdkmk,0,'NO','YES'),kglhdclt,
                                kglhdivc, kglnahsh,              decode(kglhdlmd,                        0, 'NONE',
                                      1, 'NULL',                       2, 'SHARED',                     3, 'EXCLUSIVE',
                                     'UNKOWN'),                decode(kglhdpmd,                        0, 'NONE',
                                    1, 'NULL',                       2, 'SHARED',                     3, 'EXCLUSIVE',
                                   'UNKOWN'),                decode(kglobsta,                        1, 'VALID',
                                  2, 'VALID_AUTH_ERROR',           3, 'VALID_COMPILE_ERROR',        4, 'VALID_UNAUTH',
                                 5, 'INVALID_UNAUTH',             6, 'INVALID',                    'UNKOWN'),                substr
                               (to_char(kglnatim,'YYYY-MM-DD/HH24:MI:SS'),1,19), substr(to_char(kglnaptm,'YYYY-MM-DD/HH24:MI:SS'),1
                               ,19), kglobt23, kglobt24, kglobprop, kglnahsv  from x$kglob where kglnaobj is not null

--//可以發現內容 DECODE (kglhdkmk, 0, 'NO', 'YES'),也是kglhdkmk=0,沒有keep.

select  * from x$kglob a where kglobtyd='SEQUENCE' and kglnaobj='SEQ2';

Record View
As of: 2017/11/7 11:46:03

ADDR:       00007F8F5F139D30
INDX:       1582
INST_ID:    1
KGLHDADR:   000000007B988D28
KGLHDPAR:   000000007B988D28
KGLHDCLT:   119696
KGLNAOWN:   SCOTT
KGLNAOBJ:   SEQ2
KGLFNOBJ:   SEQ2
KGLNADLK:   
KGLNAHSH:   3497251728
KGLNAHSV:   8ab86e9923d83e59d93da6ffd073d390
KGLNATIM:   2017/11/7 11:19:42
KGLNAPTM:   2017/11/7 11:01:22
KGLHDNSP:   1
KGLHDNSD:   TABLE/PROCEDURE
KGLHDLMD:   1
KGLHDPMD:   0
KGLHDFLG:   8398849
KGLHDOBJ:   000000007C9107A0
KGLHDLDC:   5
KGLHDIVC:   0
KGLHDEXC:   0
KGLHDLKC:   2
KGLHDKMK:   1
~~~~~~~~~~~~~~~
KGLHDDMK:   1
KGLHDAMK:   0
KGLOBFLG:   4
KGLOBSTA:   1
KGLOBTYP:   6
KGLOBTYD:   SEQUENCE
KGLOBHMK:   1
KGLOBHS0:   4728
KGLOBHS1:   0
KGLOBHS2:   0
KGLOBHS3:   0
KGLOBHS4:   0
KGLOBHS5:   0
KGLOBHS6:   0
KGLOBHS7:   0
KGLOBHD0:   000000007BDC2F80
KGLOBHD1:   00
KGLOBHD2:   00
KGLOBHD3:   00
KGLOBHD4:   00
KGLOBHD5:   00
KGLOBHD6:   00
KGLOBHD7:   00
KGLOBPC0:   0
KGLOBPC6:   0
KGLOBTP0:   00
KGLOBT00:   5
KGLOBT01:   0
KGLOBT02:   0
KGLOBT03:   
KGLOBT04:   0
KGLOBT05:   0
KGLOBT35:   0
KGLOBT06:   0
KGLOBT07:   0
KGLOBT08:   90561
KGLOBT09:   10
KGLOBT10:   0
KGLOBT11:   1
KGLOBT12:   0
KGLOBT13:   0
KGLOBT14:   0
KGLOBT15:   0
KGLOBT16:   0
KGLOBT17:   0
KGLOBT18:   0
KGLOBT19:   0
KGLOBT20:   0
KGLOBT21:   0
KGLOBT22:   0
KGLOBT23:   14
KGLOBT24:   27
KGLOBT25:   0
KGLOBT26:   0
KGLOBT28:   0
KGLOBT29:   0
KGLOBT30:   0
KGLOBT31:   0
KGLOBT27:   0
KGLOBT32:   0
KGLOBT33:   0
KGLOBWAP:   0
KGLOBWCC:   0
KGLOBWCL:   0
KGLOBWUI:   0
KGLOBWDW:   0
KGLOBT42:   0
KGLOBT43:   0
KGLOBT44:   0
KGLOBT45:   0
KGLOBT46:   0
KGLOBT47:   0
KGLOBT49:   0
KGLOBT50:   0
KGLOBT52:   0
KGLOBT53:   0
KGLOBTL0:   0
KGLOBTL1:   0
KGLOBTS0:   
KGLOBTS1:   
KGLOBTN0:   25
KGLOBTN1:   1
KGLOBTN2:   1
KGLOBTN3:   9999999999999999999999999999
KGLOBTN4:   20
KGLOBTN5:   41
KGLOBTS2:   
KGLOBTS3:   
KGLOBTS5:   
KGLOBTT0:   
KGLOBCCE:   
KGLOBCCEH:  0
KGLOBCLA:   
KGLOBCLC:   0
KGLOBCCC:   0
KGLOBTS4:   
KGLOBCBCA:  
KGLOBT48:   0
KGLOBDSO:   0
KGLOBDEX:   0
KGLOBDPX:   0
KGLOBDLD:   0
KGLOBDIV:   0
KGLOBDPS:   0
KGLOBDDR:   0
KGLOBDDW:   0
KGLOBDBF:   0
KGLOBDRO:   0
KGLOBDCP:   0
KGLOBDEL:   0
KGLOBDFT:   0
KGLOBDEF:   0
KGLOBDUI:   0
KGLOBDCL:   0
KGLOBDAP:   0
KGLOBDCC:   0
KGLOBDPL:   0
KGLOBDJV:   0
KGLOBACS:   0
KGLOBTS6:   
KGLOBTS7:   
KGLOBT54:   0
KGLOBT55:   0
KGLOBT56:   0
KGLOBT57:   0
KGLOBDCO:   0
KGLOBDCI:   0
KGLOBDRR:   0
KGLOBDRB:   0
KGLOBDWR:   0
KGLOBDWB:   0
KGLOBT58:   0
KGLOBDOR:   0
KGLHDMTX:   000000007B988E68
KGLHDMVL:   0
KGLHDMSP:   0
KGLHDMGT:   188
KGLHDDMTX:  000000007B988DD8
KGLHDDVL:   0
KGLHDDSP:   0
KGLHDDGT:   12
KGLHDBID:   119696
KGLHDBMTX:  0000000080FE6278
KGLHDBVL:   0
KGLHDBSP:   0
KGLHDBGT:   50
KGLOBT59:   0
KGLOBDCU:   0
KGLOBPROP:  

--//註意看~下劃線內容.
--//取消kepp看看.
SYS@book> exec dbms_shared_pool.unkeep('SCOTT.SEQ2','Q');
PL/SQL procedure successfully completed.

SELECT OWNER
      ,NAME
      ,DB_LINK
      ,NAMESPACE
      ,TYPE
      ,SHARABLE_MEM
      ,LOADS
      ,EXECUTIONS
      ,LOCKS
      ,PINS
      ,KEPT
  FROM V$DB_OBJECT_CACHE
 WHERE name = 'SEQ2' AND owner = 'SCOTT';

OWNER  NAME DB_LINK NAMESPACE       TYPE     SHARABLE_MEM      LOADS EXECUTIONS      LOCKS       PINS KEP
------ ---- ------- --------------- -------- ------------ ---------- ---------- ---------- ---------- ---
SCOTT  SEQ2         TABLE/PROCEDURE SEQUENCE         4728          5          0          2          0 NO

--//補充:有一點點奇怪seq的NAMESPACE竟然是TABLE/PROCEDUR.也就是你無法再建立seq2的表在schema=scott模式下.
SCOTT@book> create table seq2 ( a number);
create table seq2 ( a number)
             *
ERROR at line 1:
ORA-00955: name is already used by an existing object

SCOTT@book> select seq2.nextval from dual;
   NEXTVAL
----------
        41

SCOTT@book> alter system flush shared_pool;
System altered.

SCOTT@book> select seq2.nextval from dual;
   NEXTVAL
----------
        61

--//再次出現跳號.

SCOTT@book> alter system flush shared_pool;
System altered.

SYS@book> @ &r/sharepool/shp4 000000007B988D28 0
old  18:  WHERE kglobt03 = '&1'  or kglhdpar='&1' or kglhdadr='&1' or KGLNAHSH= &2
new  18:  WHERE kglobt03 = '000000007B988D28'  or kglhdpar='000000007B988D28' or kglhdadr='000000007B988D28' or KGLNAHSH= 0
TEXT           KGLHDADR         KGLHDPAR         C40    KGLHDIVC KGLOBHD0         KGLOBHD6           KGLOBHS0   KGLOBHS6   KGLOBT16   N0_6_16        N20   KGLNAHSH KGLOBT03        KGLOBT09
-------------- ---------------- ---------------- ----- --------- ---------------- ---------------- ---------- ---------- ---------- --------- ---------- ---------- ------------- ----------
父游標句柄地址 000000007B988D28 000000007B988D28 SEQ2          0 00               00                        0          0          0         0          0 3497251728                        0

--//可以僅僅堆0沒清楚了.父游標句柄還在.退出scott登錄會話依舊存在.

SYS@book> alter system flush shared_pool;
System altered.

SYS@book> @ &r/sharepool/shp4 000000007B988D28 0
old  18:  WHERE kglobt03 = '&1'  or kglhdpar='&1' or kglhdadr='&1' or KGLNAHSH= &2
new  18:  WHERE kglobt03 = '000000007B988D28'  or kglhdpar='000000007B988D28' or kglhdadr='000000007B988D28' or KGLNAHSH= 0
TEXT           KGLHDADR         KGLHDPAR         C40   KGLHDIVC KGLOBHD0         KGLOBHD6           KGLOBHS0   KGLOBHS6   KGLOBT16   N0_6_16        N20   KGLNAHSH KGLOBT03        KGLOBT09
-------------- ---------------- ---------------- ----- -------- ---------------- ---------------- ---------- ---------- ---------- --------- ---------- ---------- ------------- ----------
父游標句柄地址 000000007B988D28 000000007B988D28 SEQ2         0 00               00                        0          0          0         0          0 3497251728                        0

---//scott用戶登錄後再執行如下,再次出現跳號.
SCOTT@book> select seq2.nextval from dual;

   NEXTVAL
----------
        81

SYS@book> @ &r/sharepool/shp4 000000007B988D28 0
old  18:  WHERE kglobt03 = '&1'  or kglhdpar='&1' or kglhdadr='&1' or KGLNAHSH= &2
new  18:  WHERE kglobt03 = '000000007B988D28'  or kglhdpar='000000007B988D28' or kglhdadr='000000007B988D28' or KGLNAHSH= 0
TEXT           KGLHDADR         KGLHDPAR         C40  KGLHDIVC KGLOBHD0         KGLOBHD6           KGLOBHS0   KGLOBHS6   KGLOBT16   N0_6_16        N20   KGLNAHSH KGLOBT03        KGLOBT09
-------------- ---------------- ---------------- ---- -------- ---------------- ---------------- ---------- ---------- ---------- --------- ---------- ---------- ------------- ----------
父游標句柄地址 000000007B988D28 000000007B988D28 SEQ2        0 000000007B8F2078 00                     4728          0          0      4728       4728 3497251728                       10

總結:
1.exec dbms_shared_pool.keep('SCOTT.SEQ2','Q')後,chunk類型不會變化.
2.keep後,僅僅改動了x$kglob.KGLHDKMK值.
3.一定要自己測試看看,不要聽別人講.就信以為真.
4.順便貼上shp4的腳本:
column N0_6_16 format 99999999
SELECT DECODE (kglhdadr,
               kglhdpar, '父游標句柄地址',
               '子游標句柄地址')
          text,
       kglhdadr,
       kglhdpar,
       substr(kglnaobj,1,40) c40,
       kglhdivc,
       kglobhd0,
       kglobhd6,
       kglobhs0,kglobhs6,kglobt16,
       kglobhs0+kglobhs6+kglobt16 N0_6_16,
       kglobhs0+kglobhs1+kglobhs2+kglobhs3+kglobhs4+kglobhs5+kglobhs6+kglobt16 N20,
       kglnahsh,
       kglobt03 ,
       kglobt09  
  FROM x$kglob
 WHERE kglobt03 = '&1'  or kglhdpar='&1' or kglhdadr='&1' or KGLNAHSH= &2;


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • /* * 單向鏈表 * Node 類用來表示節點 * LinkedList 類提供了插入節點、刪除節點、顯示列表元素的方法,以及其他一些輔助方法。 */ function Node(element) { this.element = element; this.next = null; }; fun... ...
  • elementUI官方案例:http://element.eleme.io/#/zh-CN/component/date-picker (1)效果圖: (2)安裝和引入 (3)到自己的組件demo.vue里使用: ...
  • 前言 在之前的html相關的介紹中,我們已經學習了使用table來佈局網站的首頁,但是使用這種方式來佈局的話有一些缺陷,所以筆者這裡就介紹一下如何使用DIV+CSS來對網站的首頁進行佈局! 一、DIV的相關介紹 Div 它是一個 html 標簽,一個塊級元素(單獨顯示一行)。它單獨使用沒有任何意義, ...
  • 轉自CSDN: ...
  • 轉自CSDN: 購物車 我的購物車 清空購物車批量刪除 name price nu... ...
  • 學習react,使用webpack構建工具 在html引入生成的bundle.js時,寫成了這樣子: 結果報錯: 為什麼呢? 這樣不就ok了嗎!!!!!!!! 答案:看不懂英文,代碼還是看得懂的~~ https://stackoverflow.com/questions/18239430/canno ...
  • 測量應用程式的方法之一是看性能。而性能的指標之一便是用戶體驗,通俗的說法就是“用戶是否需要等待更長的時間才能得到他們想要的東西”。 這個指標在不同的應用場合而有所改變。對於移動購物應用,響應時間不能超過幾秒鐘。對於員工的人力資源頁面,可能需要多花幾秒鐘的時間。 有很多關於性能如何影響用戶行為的研究: ...
  • MySQL關聯查詢的三種寫法: SELECT * FROM film JOIN film_actor ON (film.film_id = film_actor.film_id);SELECT * FROM film JOIN film_actor USING (film_id); --當兩個要關聯 ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...