Oracle 10g 庫啟動的SGA大小由sga_target與sga_max_size決定,分下面三種情況討論
sga_target=sga_max_size
參數文件指定值
*.sga_target=599785472
啟動
SQL> startup
ORACLE instance started.
Total System Global Area 599785472 bytes
Fixed Size 2022632 bytes
Variable Size 171967256 bytes
Database Buffers 423624704 bytes
Redo Buffers 2170880 bytes
Database mounted.
Database opened.
sga_target < sga_max_size
參數文件指定值
*.sga_max_size=800m
*.sga_target=700m
啟動數據庫
SQL> startup
ORACLE instance started.
Total System Global Area 838860800 bytes
Fixed Size 2024496 bytes
Variable Size 297798608 bytes
Database Buffers 536870912 bytes
Redo Buffers 2166784 bytes
Database mounted.
Database opened.
SQL> select 838860800/1024/1024 from dual;
838860800/1024/1024
-------------------
800
SQL> show parameter sga_
NAME TYPE VALUE
------------------- ----------- -----------------------
sga_max_size big integer 800M
sga_target big integer 700M
sga_target>sga_max_size
參數文件指定值
*.sga_max_size=600m
*.sga_target=700m
而數據庫實際啟動的大小
SQL> startup
ORACLE instance started.
Total System Global Area 734003200 bytes
Fixed Size 2023656 bytes
Variable Size 192941848 bytes
Database Buffers 536870912 bytes
Redo Buffers 2166784 bytes
Database mounted.
Database opened.
SQL> select 734003200/1024/1024 from dual;
734003200/1024/1024
-------------------
700
SQL> show parameter sga_
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
sga_max_size big integer 700M
sga_target big integer 700M
實驗結論
由以上三個實驗可以看到,數據庫啟動時SGA的大小由SGA_TARGET和SGA_MAX_SIZE中的較大值決定
當SGA_TARGET <= SGA_MAX_SIZE時,以SGA_MAX_SIZE為准
當SGA_TARGET > SGA_MAX_SIZE時,將SGA_TARGET的值賦予SGA_MAX_SIZE,然後以SGA_MAX_SIZE為准