SQL> show parameter sga;
SQL> alter system set sga_max_size=4096M scope=spfile;
System altered.
SQL> alter system set sga_target=4096M scope=spfile;
System altered.
如果是RAC环境,需要这样增加sid='*':
alter system set sga_target=20G scope=spfile sid='*';
重启使更改生效:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 4294967296 bytes
Fixed Size 2026296 bytes
Variable Size 805307592 bytes
Database Buffers 3472883712 bytes
Redo Buffers 14749696 bytes
Database mounted.
Database opened.
SQL> show parameter sga;
NAME TYPE VALUE
----------- ------------------------------
lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 4G
sga_target big integer 4GSQL> show parameter pga;
不用重启DB,直接在线修改。
SQL> alter system set workarea_size_policy=auto scope=both;
System altered.SQL> alter system set pga_aggregate_target=512m scope=both;
System altered.
SQL> show parameter workarea
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
workarea_size_policy string AUTO --这个设置成AUTO
SQL> show parameter pga
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
pga_aggregate_target big integer 536870912SELECT * FROM V$PGASTAT;
aggregate PGA auto target 477379584 bytes --当前可用于自动分配了的PGA大小,应该比PGA_AGGREGATE_TARGET 小
over allocation count 1118 --实例启动后,发生的分配次数,如果这个值大于0,就要考虑增加pga的值
1 查看 SGA大小 show parameter sga_max_size db_cache_size的尺寸受 SGA的影响为能大于SGA
2 查看 show parameter shared_pool_size 尺寸
一般来说 shared_pool_size+db_cache_size=SGA_MAX_SIZE*70%左右
经过计算再修改db_cache_size
sql>alter system set db_cache_size= 大小M scope=spfile sid='数据库SID';
sql>shutdown immediate
sql>startup
sql>show parameter db_cache_size
就可以看到修改后的效果了