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='*':
原文链接:https://www.f2er.com/oracle/211875.htmlalter 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