今天查看资料时,发现db_files会对oracle的内存使用造成影响。故通过如下实验来验证这个问题。 SQL> create pfile from spfile; SQL> !vi $ORACLE_HOME/dbs/initora10g.ora 删除以下信息: ora10g.__db_cache_size=281018368 ora10g.__java_pool_size=4194304 ora10g.__large_pool_size=4194304 ora10g.__shared_pool_size=142606336 ora10g.__streams_pool_size=0 SQL> startup pfile='initora10g.ora' ORACLE instance started. Total System Global Area 440401920 bytes Fixed Size 2096952 bytes Variable Size 125829320 bytes Database Buffers 306184192 bytes Redo Buffers 6291456 bytes Database 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) ---------- 429656 SQL> create table snap_a as select * from v$sgastat; SQL> !vi $ORACLE_HOME/dbs/initora10g.ora 修改db_files=20000 SQL> startup force ORACLE instance started. Total System Global Area 440401920 bytes Fixed Size 2096952 bytes Variable Size 150995144 bytes Database Buffers 281018368 bytes Redo Buffers 6291456 bytes Database 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) ---------- 2168600 SQL> 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_M PGA_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不要预留太大,否则会大大影响到内存空间的使用