db_files 不要设置的太大,否则影响内存的使用
db_files參數限制了數據庫數據文件總的個數,datafiles數目達到db_files指定后數據庫不能添加新的數據文件,如果需要修改要重新重啟數據庫
所以這個參數都會有一定的預留,但是如果預先設置太大的話會影響oracle內存的使用
下面采取極端的 200 vs 20000 來做一個簡單的比較
首先我們來看其對SGA的影響
db_files=200
SQL> show sga
Total System Global Area? 555559728 bytes
Fixed Size?????????????????? 731952 bytes
Variable Size???????????? 385875968 bytes
Database Buffers????????? 167772160 bytes
Redo Buffers??????????????? 1179648 bytes
SQL> create table b as select * from v$sgastat;
Table created.
SQL> show parameter db_files
NAME???????????????????????????????? TYPE??????? VALUE
———————————— ———– ————————————————————
db_files???????????????????????????? integer???? 200
db_files=20000
Total System Global Area 1444753456 bytes
Fixed Size?????????????????? 733232 bytes
Variable Size??????????? 1275068416 bytes
Database Buffers????????? 167772160 bytes
Redo Buffers??????????????? 1179648 bytes
Database mounted.
Database opened.
SQL> create table e as select * from v$sgastat;
Table created.
SQL> show parameter db_files
NAME???????????????????????????????? TYPE??????? VALUE
———————————— ———– ————————————————————
db_files???????????????????????????? integer???? 20000
可以看出shared pool部分20000的db_files比200的db_files多了848M,這個多出來的值不是固定的,和其他參數還有關系,如果在正式環境上會高出更多
我遇到過db_files參數設置為10000比設置為1000要使用2G空間的情況
上面我對v$sgastat做了兩次snapshot,現在我們可以看看是哪個component占用了這些空間
SQL>? select b.pool,b.name,b.bytes before,e.bytes after,e.bytes-b.bytes delta from b,e
2?? where b.pool=e.pool and b.name=e.name and b.bytes!=e.bytes order by delta desc;
POOL??????? NAME?????????????????????????? BEFORE????? AFTER????? DELTA
———– ————————– ———- ———- ———-
shared pool free memory???????????????? 300344592? 948654528? 648309936? – 600M
shared pool Checkpoint queue????????????? 2053120? 204805120? 202752000? –? 200M
shared pool FileOpenBlock???????????????? 7517528?? 16440360??? 8922832
shared pool enqueue?????????????????????? 1833832??? 4568752??? 2734920
shared pool enqueue resources????????????? 662048??? 3236424??? 2574376
shared pool KGK heap???????????????????????? 6904???? 640600???? 633696
shared pool fixed allocation callback???????? 560??????? 640???????? 80
shared pool trigger inform??????????????????? 344??????? 216?????? -128
shared pool sim memory hea??????????????? 1274744??? 1274040?????? -704
shared pool KQR M PO?????????????????????? 118832????? 11288??? -107544
shared pool KQR L PO?????????????????????? 414720???? 235544??? -179176
shared pool KGLS heap????????????????????? 898344???? 390168??? -508176
shared pool miscellaneous??????????????? 30526568?? 29338032?? -1188536
shared pool library cache???????????????? 4324488??? 2925224?? -1399264
shared pool sql area????????????????????? 5029320??? 1234712?? -3794608
15 rows selected.
下面來看看對PGA的影響,PGA中有一部分內存空間是用來存放opened file descriptors,db_files參數設置越高,這部分預留空間越大
db_files=200
SQL> select min(value) from v$sesstat s,v$statname n
2?? where s.statistic# = n.statistic# and
3? n.name = ‘session pga memory’
4? /
MIN(VALUE)
———-
118760
db_files=20000
SQL> select min(value) from v$sesstat s,v$statname n
2?? where s.statistic# = n.statistic# and
3? n.name = ‘session pga memory’
4? /
MIN(VALUE)
———-
1866088
如果按照1000個process計算的話,PGA的差距大約為1.6G
SQL>? select 1000*(1866088-118760)/power(1024,3) from dual;
1000*(1866088-118760)/POWER(1024,3)
———————————–
1.62732601
所以db_files不要預留太大,否則會大大影響到內存空間的使用
總結
以上是生活随笔為你收集整理的db_files 不要设置的太大,否则影响内存的使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: SecureCRT的自动登录和自动脚本记
- 下一篇: sqlplus中利用spool生成带日期