注意:修改sga_target的值不能大于sga_max_size,所以sga_max_siz是sga的管理上限。
SQL> show parameter sga
NAME TYPE VALUE
------------------------------------ ----------- -------------------------
lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 416M
sga_target big integer 200M
SQL> alter system set sga_target=500m scope=spfile ;
alter system set sga_target=500m scope=spfile ;
*
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-00823: Specified value of sga_target greater than sga_max_size
#查看sga中各池真实的大小:
SQL> select name,bytes/1024/1024 m from v$sgainfo;
NAME M
-------------------------------- ----------
Fixed SGA Size 1.27510452
Redo Buffers 5.78515625
Buffer Cache Size 80
Shared Pool Size 148
Large Pool Size 4
Java Pool Size 4
Streams Pool Size 0
Shared IO Pool Size 0
Granule Size 4
Maximum SGA Size 415.0625
Startup overhead in Shared Pool 52
NAME M
-------------------------------- ----------
Free SGA Memory Available 172
12 rows selected.
案例:设置sga_target
SQL> ALTER system SET sga_max_size=1000m scope=spfile;
SQL> ALTER system SET sga_target=1000m scope=spfile;
3.shared pool的调整:
#查看shared pool 参数 (为0表示shared pool为自动管理)
SQL> show parameter shared_pool_size
NAME TYPE VALUE
------------------------------------ ----------- -------------------------
shared_pool_size big integer 0
#查看shared pool的真实大小
SQL> select name,bytes/1024/1024 m from v$sgainfo;
NAME M
-------------------------------- ----------
Fixed SGA Size 1.27510452
Redo Buffers 5.78515625
Buffer Cache Size 80
Shared Pool Size 148
Large Pool Size 4
Java Pool Size 4
Streams Pool Size 0
Shared IO Pool Size 0
Granule Size 4
Maximum SGA Size 415.0625
Startup overhead in Shared Pool 52
#调大shared pool 的值
SQL> alter system set shared_pool_size=160m ;
System altered.
#查询
SQL> select name,bytes/1024/1024 m from v$sgainfo;
NAME M
-------------------------------- ----------
Fixed SGA Size 1.27510452
Redo Buffers 5.78515625
Buffer Cache Size 68
Shared Pool Size 160
Large Pool Size 4
Java Pool Size 4
Streams Pool Size 0
Shared IO Pool Size 0
Granule Size 4
Maximum SGA Size 415.0625
Startup overhead in Shared Pool 52
NAME M
-------------------------------- ----------
Free SGA Memory Available 172
12 rows selected.
#调小 shared pool的值, 发现shared pool还是160m,所以shared pool 只能调大不能调小。
SQL> alter system set shared_pool_size=148m;
System altered.
SQL> select name,bytes/1024/1024 m from v$sgainfo;
NAME M
-------------------------------- ----------
Fixed SGA Size 1.27510452
Redo Buffers 5.78515625
Buffer Cache Size 68
Shared Pool Size 160
Large Pool Size 4
Java Pool Size 4
Streams Pool Size 0
Shared IO Pool Size 0
Granule Size 4
Maximum SGA Size 415.0625
Startup overhead in Shared Pool 52
NAME M
-------------------------------- ----------
Free SGA Memory Available 172