[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/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BTL0: 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: 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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;