標籤:available family back middle buffers sof sel 一段 cache
在9i後,SGA的內部組件大小可以動態調整,也可以由資料庫自動管理,在設定記憶體大小的時候,分配的基本單位是粒度(granule)
- granule是一段連續的虛擬記憶體,大小地區決SGA_MAX_SIZE大小
- SGA_MAX_SIZE小於128M,Granule為4M,否則Granule為16M
- 每個記憶體組件分配大小必須為Granule的整數倍
- 整個SGA最小不小於3個Granule大小
- 查看granule大小:v$sgainfo
- 如下,因為sga_max_size大小大於128M,所以granule大小為16M
SQL> select name,bytes/1024/1024 MB,resizeable from v$sgainfo;
NAME MB RES
-------------------------------- ---------- ---
Fixed SGA Size 2.14937592 No
Redo Buffers 6.765625 No
Buffer Cache Size 608 Yes
Shared Pool Size 272 Yes
Large Pool Size 32 Yes
Java Pool Size 16 Yes
Streams Pool Size 0 Yes
Shared IO Pool Size 0 Yes
Granule Size 16 No
Maximum SGA Size 1576.91797 No
Startup overhead in Shared Pool 189.55072 No
Free SGA Memory Available 640
12 rows selected.
SQL> show parameter sga_max_size
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
sga_max_size big integer 1584M
再看如下例子:
雖然設定shared_pool_size大小為10M,但是查看是確實16M,那是因為分配記憶體的基本單位是粒度granule.每個記憶體組件分配大小必須為granule的整數倍.
SQL> show parameter shared_p;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
shared_pool_reserved_size big integer 10066329
shared_pool_size big integer 0
SQL> alter system set shared_pool_size=10M;
System altered.
SQL> show parameter shared_p;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
shared_pool_reserved_size big integer 10066329
shared_pool_size big integer 16M
Oracle分配記憶體的基本單位:Granule(粒度)