背景:
根据需求生产环境为了增加稳定性,避免内存组件过度扩张,因此使用ASMM自动共享内存管理方式,并且手工设定
shared_pool_size,db_cache_size的大小。
如下操作的原因是因为:在直接修改操作的时候报错:
ORA-00843: Parameter not taking MEMORY_MAX_TARGET into account
ORA-00849: SGA_TARGET 10737418240 cannot be set to more than MEMORY_MAX_TARGET 0.
--1.查看当前内存组件参数值
col name for a30;
col VALUE for a30;
select INST_ID,name, VALUE / 1024 / 1024 size_MB, issys_modifiable
from gv$parameter
where name in ('pga_aggregate_target',
'memory_target',
'memory_max_target',
'sga_max_size',
'sga_target',
'shared_pool_size',
'db_cache_size',
'java_pool_size',
'large_pool_size',
'streams_pool_size')
order by 2,1;
--2.查看PGA使用过的最大值
select INST_ID,value/1024/1024 SIZE_M from gv$pgastat where name='maximum PGA allocated';
INST_ID SIZE_M
---------- ----------
1 286.93457
2 269.886719
--3.当前系统参数配置
NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
memory_target big integer 10G
memory_max_target big integer 10G
sga_max_size big integer 10G (该系统当前值设置有问题)
sga_target big integer 0
pga_aggregate_target big integer 0
--4计划调整内存组件参数如下:
--自动共享内存管理(ASMM)
--注意这里是因为该系统是OLAP和OLTP功能混用,所以内存分配特殊
memory_target big integer 0
memory_max_target big integer 0
sga_max_size big integer 8G
sga_target big integer 0
pga_aggregate_target big integer 10G
shared_pool_size big integer 4G
db_cache_size big integer 2G
--5.确认参数文件并于操作前备份参数文件
show parameter spfile;(操作前要有参数文件备份)
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATEDG/rac11g/spfilerac11g.ora
create pfile='/home/oracle/oldpfile.ora' from spfile ='+DATEDG/rac11g/spfilerac11g.ora';
--6.修改内存组件参数:
1节点:
alter system set memory_max_target=0 scope=spfile sid='*';
alter system set sga_max_size=8192M scope=spfile sid='rac11g1';
alter system set memory_target=0 sid='rac11g1';
alter system set sga_target=0 sid='rac11g1';
alter system set pga_aggregate_target=10240M sid='rac11g1';
shutdown immediate;
2节点:
alter system set sga_max_size=8192M scope=spfile sid='rac11g2';
alter system set memory_target=0 sid='rac11g2';
alter system set sga_target=0 sid='rac11g2';
alter system set pga_aggregate_target=10240M sid='rac11g2';
shutdown immediate;
--7.使用跟新后的spfile创建pfile然后修改
节点1:
使用跟新后的spfile创建pfile然后修改
create pfile='/home/oracle/newpfile.ora' from spfile ='+DATEDG/rac11g/spfilerac11g.ora';
--8.注释(参见文档 ID 1397761.1)
注释:
vi /home/oracle/newpfile.ora
#*.memory_max_target=0
#rac11g1.memory_target=0
#rac11g2.memory_target=0
--9.使用修改后的newpfile重建参数文件(原spfile可以重命名备份):
create spfile='+DATEDG/rac11g/spfilerac11g.ora' from pfile='/home/oracle/newpfile.ora';
--10.分别启动数据库
启动数据库(两节点分别启动):
startup;
--11.确认参数设置情况(两节点):
确认参数设置情况(两节点):
show parameter memory_max_target;
show parameter sga_max_size;
show parameter memory_target;
show parameter sga_target;
show parameter pga_aggregate_target;
--12.设置shared_pool_size和db_cache_size参数:
设置shared_pool_size和db_cache_size参数:
1节点:
alter system set shared_pool_size=4096M sid='rac11g1';
alter system set db_cache_size= 2048M sid='rac11g1';
2节点:
alter system set shared_pool_size=4096M sid='rac11g2';
alter system set db_cache_size= 2048M sid='rac11g2';
--13.确认参数设置情况(两节点):
确认参数设置情况(两节点):
show parameter shared_pool_size;
show parameter db_cache_size;
--14.
查看日志是否有报错信息:
----------
备注:
参考文档:
ORA-00843, ORA-00849 When Trying To Change SGA_TARGET With MEMORY_MAX_TARGET=0 Being Active (文档 ID 1397761.1)
根据需求生产环境为了增加稳定性,避免内存组件过度扩张,因此使用ASMM自动共享内存管理方式,并且手工设定
shared_pool_size,db_cache_size的大小。
如下操作的原因是因为:在直接修改操作的时候报错:
ORA-00843: Parameter not taking MEMORY_MAX_TARGET into account
ORA-00849: SGA_TARGET 10737418240 cannot be set to more than MEMORY_MAX_TARGET 0.
--1.查看当前内存组件参数值
col name for a30;
col VALUE for a30;
select INST_ID,name, VALUE / 1024 / 1024 size_MB, issys_modifiable
from gv$parameter
where name in ('pga_aggregate_target',
'memory_target',
'memory_max_target',
'sga_max_size',
'sga_target',
'shared_pool_size',
'db_cache_size',
'java_pool_size',
'large_pool_size',
'streams_pool_size')
order by 2,1;
--2.查看PGA使用过的最大值
select INST_ID,value/1024/1024 SIZE_M from gv$pgastat where name='maximum PGA allocated';
INST_ID SIZE_M
---------- ----------
1 286.93457
2 269.886719
--3.当前系统参数配置
NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
memory_target big integer 10G
memory_max_target big integer 10G
sga_max_size big integer 10G (该系统当前值设置有问题)
sga_target big integer 0
pga_aggregate_target big integer 0
--4计划调整内存组件参数如下:
--自动共享内存管理(ASMM)
--注意这里是因为该系统是OLAP和OLTP功能混用,所以内存分配特殊
memory_target big integer 0
memory_max_target big integer 0
sga_max_size big integer 8G
sga_target big integer 0
pga_aggregate_target big integer 10G
shared_pool_size big integer 4G
db_cache_size big integer 2G
--5.确认参数文件并于操作前备份参数文件
show parameter spfile;(操作前要有参数文件备份)
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATEDG/rac11g/spfilerac11g.ora
create pfile='/home/oracle/oldpfile.ora' from spfile ='+DATEDG/rac11g/spfilerac11g.ora';
--6.修改内存组件参数:
1节点:
alter system set memory_max_target=0 scope=spfile sid='*';
alter system set sga_max_size=8192M scope=spfile sid='rac11g1';
alter system set memory_target=0 sid='rac11g1';
alter system set sga_target=0 sid='rac11g1';
alter system set pga_aggregate_target=10240M sid='rac11g1';
shutdown immediate;
2节点:
alter system set sga_max_size=8192M scope=spfile sid='rac11g2';
alter system set memory_target=0 sid='rac11g2';
alter system set sga_target=0 sid='rac11g2';
alter system set pga_aggregate_target=10240M sid='rac11g2';
shutdown immediate;
--7.使用跟新后的spfile创建pfile然后修改
节点1:
使用跟新后的spfile创建pfile然后修改
create pfile='/home/oracle/newpfile.ora' from spfile ='+DATEDG/rac11g/spfilerac11g.ora';
--8.注释(参见文档 ID 1397761.1)
注释:
vi /home/oracle/newpfile.ora
#*.memory_max_target=0
#rac11g1.memory_target=0
#rac11g2.memory_target=0
--9.使用修改后的newpfile重建参数文件(原spfile可以重命名备份):
create spfile='+DATEDG/rac11g/spfilerac11g.ora' from pfile='/home/oracle/newpfile.ora';
--10.分别启动数据库
启动数据库(两节点分别启动):
startup;
--11.确认参数设置情况(两节点):
确认参数设置情况(两节点):
show parameter memory_max_target;
show parameter sga_max_size;
show parameter memory_target;
show parameter sga_target;
show parameter pga_aggregate_target;
--12.设置shared_pool_size和db_cache_size参数:
设置shared_pool_size和db_cache_size参数:
1节点:
alter system set shared_pool_size=4096M sid='rac11g1';
alter system set db_cache_size= 2048M sid='rac11g1';
2节点:
alter system set shared_pool_size=4096M sid='rac11g2';
alter system set db_cache_size= 2048M sid='rac11g2';
--13.确认参数设置情况(两节点):
确认参数设置情况(两节点):
show parameter shared_pool_size;
show parameter db_cache_size;
--14.
查看日志是否有报错信息:
----------
备注:
参考文档:
ORA-00843, ORA-00849 When Trying To Change SGA_TARGET With MEMORY_MAX_TARGET=0 Being Active (文档 ID 1397761.1)