oracle调整sga、pga大小

修改sga大小

1-1查看当前sga大小

SQL> show parameter sga

1-2修改sga_max_size为24G

SQL> alter system set sga_max_size=24G scope=spfile;

1-3修改sga_target为24G

SQL> alter system set sga_target=24G scope=spfile;

1-4重启生效

SQL> shutdown immediate

SQL> startup

SQL> show parameter sga

修改pga大小

2-1查看当前pga大小

SQL> show parameter pga

2-2修改workarea_size_policy为AUTO

SQL> alter system set workarea_size_policy=auto scope=both;

SQL> show parameter workarea

2-3修改pga_aggregate_target为8G

SQL> alter system set pga_aggregate_target=8G scope=both;

pga为动态参数,不需要重启,修改完直接生效

SQL> show parameter pga

内存监控

3-1查看实际pga分配情况

SQL> SELECT * FROM V$PGASTAT;

 

aggregate PGA auto target

--当前可用于自动分配了的PGA大小,应该比PGA_AGGREGATE_TARGET 小

over allocation count

--实例启动后,发生的分配次数,如果这个值大于0,就要考虑增加pga的值

3-2查看sga和pga的使用情况

SQL> select name,total,round(total-free,2) used, round(free,2) free,round((total-free)/total*100,2) pctused from

(select 'SGA' name,(select sum(value/1024/1024) from v$sga) total,

(select sum(bytes/1024/1024) from v$sgastat where name='free memory')free from dual)

union

select name,total,round(used,2)used,round(total-used,2)free,round(used/total*100,2)pctused from (

select 'PGA' name,(select value/1024/1024 total from v$pgastat where name='aggregate PGA target parameter')total,

(select value/1024/1024 used from v$pgastat where name='total PGA allocated')used from dual);

你可能感兴趣的:(oracle调整sga、pga大小)