当前位置:数据库 > Oracle >>

oracle sub share pool简介以及共享sql实现实质

oracle sub share pool简介以及共享sql实现实质
 
  我们知道在9i开始shared pool已经增加了sub shared pool,我们可以通过转储shared pool来查看,并且到了10g每
个sub shared pool被划分了四个分区,同样通过转储的信息可以 看到sga heap(1,0),sga heap(1,1),sga
heap(1,2) ,sga heap(1,3)。
  另外对于sub shared pool最多有7个,如果cpu个数大于4,且shared pool size 大于250M(10g sub shared pool至
少为256M,11g为512mb)。
该值受隐含参数控制:
可以看到我主机cpu个数为32颗,shared pool size为:2G那么就启用了sub shared pool功能。
[sql] 
23:03:00 sys@REPDB>set linesize 200  
23:03:03 sys@REPDB>@getsp.sql  
ÊäÈë par µÄÖµ:  kgh  
Ô­Öµ    2: where a.indx=b.indx and a.ksppinm like '%&par%'  
ÐÂÖµ    2: where a.indx=b.indx and a.ksppinm like '%kgh%'  
  
KSPPINM                                            KSPPSTVL             KSPPDESC  
-------------------------------------------------- -------------------- ------------------------------------------------------------  
_kghdsidx_count                                    7                    max kghdsidx count  
  
23:03:09 sys@REPDB>show parameter shared_pool_size  
  
NAME                                 TYPE        VALUE  
------------------------------------ ----------- ------------------------------  
shared_pool_size                     big integer 2G  
23:04:08 sys@REPDB>  
每个sub sharedpool 都有单独的shared pool latch进行管理:
[sql] 
23:07:57 sys@REPDB>select addr,latch#,name,gets,misses,sleeps,spin_gets,immediate_gets,immediate_misses from v$latch_children where name='shared pool';  
  
ADDR                 LATCH# NAME                                                     GETS     MISSES     SLEEPS  SPIN_GETS IMMEDIATE_GETS IMMEDIATE_MISSES  
---------------- ---------- -------------------------------------------------- ---------- ---------- ---------- ---------- -------------- ----------------  
C000000048EE76B0        216 shared pool                                          59703790       8097       1028       7091              0                0  
C000000048EE7610        216 shared pool                                          74572270      11489       1743       9799              0                0  
C000000048EE7570        216 shared pool                                          85353572      16887       2974      14033              0                0  
C000000048EE74D0        216 shared pool                                          88043530      18467       3128      15470              0                0  
C000000048EE7430        216 shared pool                                          66513683      10129       1126       9036              0                0  
C000000048EE7390        216 shared pool                                          84015797      13276       1788      11553              0                0  
C000000048EE72F0        216 shared pool                                         578252857      36040       5139      31168              0                0  
  
  
已选择7行。  
23:08:42 sys@REPDB>  
另外对于每个sub spool的使用情况也看查看x$kghlu;
  对于library cache的转储有如下等级:
level 1,转储library cache 统计信息
level 2,转储hash table 概要
level  4,转储library cache 对象,只包含基本信息
level 8,转储library cache 对象,包含详细信息(如 child references,pin waiters等)
level 16 增加heap sizes 信息
level 32 增加heap信息:
(如上等级转载是eygle的blog)
摘自网络一张shared pool中library cache 图,如下:
 
 
 
对于library cache 有很多hash buckets组成,然后每个hash buckets又有library cache handel(指向library cache object的指针,namespace等信息),library cache object的heap 0为控制信息。
如下所示sql共享的过程:
首先在不同用户下执行sql
[sql] 
<p>SQL> startup force  
ORACLE instance started.</p><p>Total System Global Area  492707840 bytes  
Fixed Size                  2254544 bytes  
Variable Size             339740976 bytes  
Database Buffers          146800640 bytes  
Redo Buffers                3911680 bytes  
Database mounted.  
Database opened.  
</p>  
[sql] 
SQL> conn scott/root  
Connected.  
SQL> set linesize 200  
SQL> select * from emp;  
  
     EMPNO ENAME
Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,