ORACLE 記憶體管理 之六 SGA Multiple Block Sizes,Large Pool

weifenghq發表於2007-01-05

ORACLE DBA 記憶體管理 SGA Multiple Block Sizes,Large Pool

Multiple Block Sizes

9i前只能設定一種blocksize,如果想改變只能重灌資料庫.9I後可以設定多種.要設定多種blocksize必須先設定相應的buffer cache area.

SQL> show parameter cache_size

NAME TYPE VALUE

------------------------------------ ---------------------- -------------------

db_16k_cache_size big integer 0

db_2k_cache_size big integer 0

db_32k_cache_size big integer 0

db_4k_cache_size big integer 0

db_8k_cache_size big integer 0

db_cache_size big integer 243269632

db_keep_cache_size big integer 0

db_recycle_cache_size big integer 0

SQL> show parameter db_block_size

NAME TYPE VALUE

------------------------------------ ---------------------- ---------

db_block_size integer 8192

可以看到DEFAULT8K,預設值用的時db_cache_size所以是不需要設定相應的db_xk_cache_size的。

當想建立一個32K的表空間但是又沒有設定 db_32k_cache_size的時候會出錯的:

1 create tablespace ts_wwm_32k

2 datafile 'D:ORACLEORADATAJMCOEMDBTS_WWM_32K.DBF' size 10m

3* blocksize 32k

SQL> /

create tablespace ts_wwm_32k

*

ORA-29339: 表空間塊大小32768 與配置的塊大小不匹配

所以必須先設定32Kcache size,要保證有這部分空餘mem可以分配出來,先看sga_max_size是否大於當前sga 的大小,如果大於當前sga說明有一部分mem沒有分配,可以用來分配給32k_cache_size。如果等於當前sga的大小說明可用記憶體都已用掉,此時需要縮小其他元件的大小來讓出地方給32k_cache_Size.

SQL> show sga

Total System Global Area 420551900 bytes

Fixed Size 453852 bytes

Variable Size 176160768 bytes

Database Buffers 243269632 bytes

Redo Buffers 667648 bytes

SQL> show parameter sga_max_size

NAME TYPE VALUE

------------------------------------ ---------------------- --------------

sga_max_size big integer 420551900

可以看到sga_max_size=420551900

縮小default db_cache_Size以便空出地方。

SQL> alter system set db_cache_Size=200M;

SQL> alter system set db_32k_cache_size=50m;
alter system set db_32k_cache_size=50m
*
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-00382: 32768 not a valid block size, valid range [2048..16384]

由於做實驗用的是WIN2000,只支援2k---16k.所以修改成16K

1* alter system set db_16k_cache_size=30M

create tablespace ts_wwm_16k

datafile 'D:ORACLEORADATAJMCOEMDBTS_WWM_16K.DBF' size 20M

blocksize 16k;

表空間已建立.

現在有了兩個buffer cache,8kcache size200M,16K的是30M,這兩個區域不能通用,16K30M用完後不能用8k200M.所以增加靈活性的同時也增加了管理的複雜性.

large pool 並不是因為他本身大,而是說他分配的PIECE比較大,8.0large pool需要實現的功能都在shared pool裡實現.但是shared pool裡用LRU演算法,LRU對於那些用了之後還要用的資料比較好,LARGE的特徵卻是需要的時候要分配大塊的記憶體,不需要的時候可以不保留資料,也就是說不會被重用. 所以8.0後就單獨分出來large pool.shared poollarge pool的關係就像buffer cache裡的 recyclekeep的關係一樣,large pool,就相當於recycleshared pool就像keep一樣。

Large pool在一下情況用到:

* Shared Server Connections – to allocate the UGA region in the SGA.

* Parallel Execution of statements – to allow for the allocation of inter-process message buffers, used to coordinate the parallel query servers.

* Backup – for RMAN disk I/O buffers in some cases.

摘自:[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/633084/viewspace-888425/,如需轉載,請註明出處,否則將追究法律責任。

相關文章