db_files对于oracle使用内存的影响

来源:互联网 发布:hc05蓝牙测试软件 编辑:程序博客网 时间:2024/06/06 15:37
今天查看资料时,发现db_files会对oracle的内存使用造成影响。故通过如下实验来验证这个问题。SQL> create pfile from spfile;SQL> !vi $ORACLE_HOME/dbs/initora10g.ora删除以下信息:ora10g.__db_cache_size=281018368ora10g.__java_pool_size=4194304ora10g.__large_pool_size=4194304ora10g.__shared_pool_size=142606336ora10g.__streams_pool_size=0SQL> startup pfile='initora10g.ora' ORACLE instance started.Total System Global Area  440401920 bytesFixed Size    2096952 bytesVariable Size  125829320 bytesDatabase Buffers  306184192 bytesRedo Buffers    6291456 bytesDatabase mounted.Database opened.SQL>   select min(value) from v$sesstat s,v$statname n     where s.statistic# = n.statistic# and    n.name = 'session pga memory';  2    3  MIN(VALUE)----------    429656SQL> create table snap_a as select * from v$sgastat;SQL> !vi $ORACLE_HOME/dbs/initora10g.ora修改db_files=20000SQL> startup forceORACLE instance started.Total System Global Area  440401920 bytesFixed Size    2096952 bytesVariable Size  150995144 bytesDatabase Buffers  281018368 bytesRedo Buffers    6291456 bytesDatabase mounted.Database opened.SQL> select min(value) from v$sesstat s,v$statname n     where s.statistic# = n.statistic# and    n.name = 'session pga memory';  2    3  MIN(VALUE)----------   2168600SQL> create table snap_b as select * from v$sgastat;查看sga、pga前后差值:SQL>  select (150995144-125829320)/1024/1024 SGA_M,(2168600-429656)/1024/1024 PGA_M from dual;     SGA_MPGA_M---------- ----------24 1.65838623
上面对v$sgastat做了两次snapshot,可以看看是哪个component占用了这些空间:select b.pool,b.name,b.bytes before,e.bytes after,e.bytes-b.bytes delta from snap_a b,snap_b e  where b.pool=e.pool and b.name=e.name and b.bytes!=e.bytes order by delta desc;PGA中有一部分内存空间是用来存放opened file descriptors,db_files参数设置越高,这部分预留空间越大所以db_files不要预留太大,否则会大大影响到内存空间的使用