[20171107]dbms_shared_pool.pin补充.txt

[20171107]dbms_shared_pool.pin补充.txt

--//上午的测试,做一些补充,主要还是一些理解问题.

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

2.测试:
--//session 1:
SCOTT@book> select seq2.nextval from dual;

   NEXTVAL
----------
       142

--//注:执行许多次了.
--//session 2:
SELECT KGLHDADR, KGLHDPAR, KGLHDCLT, KGLNAOWN, KGLNAOBJ, KGLFNOBJ
  FROM x$kglob a
WHERE kglobtyd = 'SEQUENCE'
   AND kglnaobj = 'SEQ2';

KGLHDADR         KGLHDPAR           KGLHDCLT KGLNAOWN KGLNAOBJ                       KGLFNOBJ
---------------- ---------------- ---------- -------- ------------------------------ --------------------
000000007BBBCFF0 000000007BBBCFF0     119696 SCOTT    SEQ2                           SEQ2

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

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

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

--//快下班在这里转不出来,为什么还在共享池中,仅仅堆0信息被清除了.下午才想起来,如果会话不退出,无论如何刷新,都存在的.
--//session 1 ,现在退出.

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

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

SYS@book> @ &r/sharepool/shp4 000000007BBBCFF0 0
old  18:  WHERE kglobt03 = '&1'  or kglhdpar='&1' or kglhdadr='&1' or KGLNAHSH= &2
new  18:  WHERE kglobt03 = '000000007BBBCFF0'  or kglhdpar='000000007BBBCFF0' or kglhdadr='000000007BBBCFF0' or KGLNAHSH= 0
no rows selected

--//可以发现现在已经不再共享池了,自己有点蒙....^_^.

3.再看看keep的情况.

--//session 1:
SCOTT@book> select seq2.nextval from dual;
   NEXTVAL
----------
       162

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

SELECT KGLHDADR, KGLHDPAR, KGLHDCLT, KGLNAOWN, KGLNAOBJ, KGLFNOBJ ,KGLHDKMK
  FROM x$kglob a
WHERE kglobtyd = 'SEQUENCE'
   AND kglnaobj = 'SEQ2';

KGLHDADR         KGLHDPAR           KGLHDCLT KGLNAOWN KGLNAOBJ KGLFNOBJ               KGLHDKMK
---------------- ---------------- ---------- -------- -------- -------------------- ----------
000000007D2CD020 000000007D2CD020     119696 SCOTT    SEQ2     SEQ2                          1

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

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

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

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

--//即使session 1退出,这个seq2也会保持在共享池中.
SYS@book> alter system flush shared_pool;
System altered.

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

--//这让想起vage书中讲解,刷新一定要一组相似的程序不再运行,刷新才能剔除许多组件.

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

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

SYS@book> @ &r/sharepool/shp4 000000007D2CD020 0
old  18:  WHERE kglobt03 = '&1'  or kglhdpar='&1' or kglhdadr='&1' or KGLNAHSH= &2
new  18:  WHERE kglobt03 = '000000007D2CD020'  or kglhdpar='000000007D2CD020' or kglhdadr='000000007D2CD020' or KGLNAHSH= 0
no rows selected

SELECT KGLHDADR, KGLHDPAR, KGLHDCLT, KGLNAOWN, KGLNAOBJ, KGLFNOBJ ,KGLHDKMK
  FROM x$kglob a
WHERE kglobtyd = 'SEQUENCE'
  AND kglnaobj = 'SEQ2';
no rows selected

--//顺便测试,这样是否可以keep.

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

SELECT KGLHDADR, KGLHDPAR, KGLHDCLT, KGLNAOWN, KGLNAOBJ, KGLFNOBJ ,KGLHDKMK
  FROM x$kglob a
WHERE kglobtyd = 'SEQUENCE'
   AND kglnaobj = 'SEQ2';

KGLHDADR         KGLHDPAR           KGLHDCLT KGLNAOWN KGLNAOBJ KGLFNOBJ KGLHDKMK
---------------- ---------------- ---------- -------- -------- -------- --------
000000007DBFCD50 000000007DBFCD50     119696 SCOTT    SEQ2     SEQ2            1

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

--//另外还有一个不理解的地方,KGLOBT09=10表示什么?在sql语句中这个表示child_number.

时间: 2024-10-13 19:36:54

[20171107]dbms_shared_pool.pin补充.txt的相关文章

[20171107]dbms_shared_pool.pin.txt

[20171107]dbms_shared_pool.pin.txt --//昨天与别人聊天提到,如果dbms_shared_pool.pin对象,可以改变对应的chunk的类型.我自己也不确定,做一次测试. 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -------------- ----------------

[20171115]恢复数据文件块头3补充.txt

[20171115]恢复数据文件块头3补充.txt --// 昨天做了恢复数据文件块头,通过备份文件直接取出文件块头,覆盖原来的数据块,然后修复. --//补充几点: --1.文件头损坏,无法使用rman的块恢复功能. --2.文件头损坏,dbv检查发现都是坏块.我感觉主要文件块头损坏,dbv无法定位其它剩下的块. 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER --------

[20170916]sqlplus set array最小2补充.txt

[20170916]sqlplus set array最小2补充.txt --//以前写的贴子,链接http://blog.itpub.net/267265/viewspace-1453652/ --//上面提到设置array=1或者array=2.执行sql语句输出的逻辑读是一样的,所以得到一个结论. --//set array最小是2. --//我也在http://blog.itpub.net/267265/viewspace-2138596/里面提到.fetch 与arraysize的关系

[20160407]bbed修改文件头2(补充).txt

[20160407]bbed修改文件头2(补充).txt --昨天被别人问一个问题,就是我的测试修改数据文件相应的CHECKPOINT_CHANGE#就ok了.偏移量是block=1的offset=484. --链接 http://blog.itpub.net/267265/viewspace-2075424/ --不过别人问的是这个时间是如何存储的.我以前也做过一些.链接: --http://blog.itpub.net/267265/viewspace-746222/ --我的感觉在11.2

[20150128]关于flashback补充.txt

[20150128]关于flashback补充.txt --昨天别人问restore point的信息保存在那里,我想一定在控制文件里面,这个很容易验证. --而且一旦flashback 日志删除,无法定位restore point的名字.继续昨天的测试: 1.建立测试环境: SYS@test> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -----

[20161012]linux free的补充.txt

[20161012]linux free的补充.txt --前一阵子写的: http://blog.itpub.net/267265/viewspace-2124363/ 下面是关于buffers和cached的英文资料: Buffers are associated with a specific block device, and cover caching of filesystem metadata as well as tracking in-flight pages. The cac

[20140102]ORA-00600 [kkocxj pjpCtx] error is reported when running之补充.txt

[20140102]ORA-00600 [kkocxj  pjpCtx] error is reported when running之补充.txt 去年我写一篇blog,链接如下:http://blog.itpub.net/267265/viewspace-1065675/ 有人问sql profiles如何建立,以前我一直是手工编写命令执行,不是很方面,正好放假看了.Apress.Pro.Oracle.SQL.2nd.Edition.Nov.2013.pdf 我修改脚本其中的脚本move_s

[20120809]学习物化视图(补充).txt

[20120809]学习物化视图(补充).txt 1.测试环境: SQL> select * from v$version ; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production PL/SQL Release 11.2.0

[20131210]11G的内部视图X$DBGALERTEXT补充.txt

[20131210]11G的内部视图X$DBGALERTEXT补充.txt http://blog.itpub.net/267265/viewspace-775126/ 曾经写过一篇blog,以前我们看alert*.log文件,一般直接进入目录,直接查看.当然也可以通过外部表来访问alert*.log. 而11G开始引入了新的ADR自动诊断仓库特性,默认的Alert.log转换为LOG.XML的形式,默认存放在$ADR_HOME/alert&trace目录下,并且 为日志条目增加了如Level之