客户有个11g rac环境,前一段时间db1内存故障了,更换后需要调整db1的sga和pga,操作如下
SQL> alter system set sga_target=25G scope=spfile sid='*';
System altered.
SQL> alter system set sga_max_size=25G scope=spfile sid='*';
System altered.
SQL> alter system set pga_aggregate_target=15G scope=spfile sid='*';
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 8017100800 bytes
Fixed Size 2269072 bytes
Variable Size 1795162224 bytes
Database Buffers 6207569920 bytes
Redo Buffers 12099584 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 7680M
sga_target big integer 7680M
SQL> show parameter pga
NAME TYPE VALUE
-------------------- ----------- -------
pga_aggregate_target big integer 2560M
重启后发现sga和pga和重启前一样,奇怪,查看2个主机的spfile,同样的文件,不存在问题
SYS@orcl2> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATA/orcl/spfileorcl.ora
SYS@orcl2>
SYS@orcl1> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATA/orcl/spfileorcl.ora
SYS@orcl1>
spfile导出pfile查看,发现2个节点的sga和pga确实不一样
orcl1:/home/oracle@db1> more /tmp/orcl1.pfile
orcl2.__db_cache_size=22213033984
orcl1.__db_cache_size=6476005376
orcl2.__java_pool_size=402653184
orcl1.__java_pool_size=100663296
orcl2.__large_pool_size=469762048
orcl1.__large_pool_size=117440512
orcl1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
orcl2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
orcl2.__pga_aggregate_target=16106127360
orcl1.__pga_aggregate_target=2684354560
orcl2.__sga_target=26843545600
orcl1.__sga_target=8053063680
orcl2.__shared_io_pool_size=0
orcl1.__shared_io_pool_size=0
orcl2.__shared_pool_size=3489660928
orcl1.__shared_pool_size=1275068416
orcl2.__streams_pool_size=134217728
orcl1.__streams_pool_size=33554432
*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
*.audit_sys_operations=TRUE
*.audit_trail='DB','EXTENDED'
*.cluster_database=TRUE
*.compatible='11.2.0.4.0'
*.control_file_record_keep_time=14
*.control_files='+DATA/orcl/controlfile/current.260.1021284275','+FRA/orcl/controlfile/current.256.1021284275'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_create_online_log_dest_1='+DATA'
*.db_create_online_log_dest_2='+FRA'
*.db_domain=''
*.db_name='orcl'
*.deferred_segment_creation=FALSE
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
orcl2.instance_number=2
orcl1.instance_number=1
*.java_jit_enabled=TRUE
*.log_archive_dest_1='LOCATION=+FRA'
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
orcl1.pga_aggregate_target=2684354560
*.pga_aggregate_target=16106127360
orcl1.processes=1000
*.processes=5120
*.recyclebin='ON'
*.remote_listener='db-scan:1521'
*.remote_login_passwordfile='exclusive'
*.sessions=1105
orcl1.sga_max_size=8053063680
*.sga_max_size=26843545600
orcl1.sga_target=8053063680
*.sga_target=26843545600
orcl2.thread=2
orcl1.thread=1
*.undo_retention=14400
orcl2.undo_tablespace='UNDOTBS2'
orcl1.undo_tablespace='UNDOTBS1'
到这里有点蒙,冷静下一想,db1故障时调整内存使用的sid='orcl1',使用sid='orcl1'调整试一试
SQL> alter system set sga_target=25G scope=spfile sid='orcl1';
System altered.
SQL> alter system set sga_max_size=25G scope=spfile sid='orcl1';
System altered.
SQL> alter system set pga_aggregate_target=15G scope=spfile sid='orcl1';
System altered.
调整后再次重启,发现sga和pga调整过了,达到了预期的效果。
第一次遇见这种问题,记录下,该环境已应用了2019年4月的补丁,