前言:
在对ASM实例参数进行配置时,可能会遇到参数修改之后无法正常启动ASM实例的情况,这时候需要我们人为的对参数文件配置进行修正乃至回退,但ASM实例的参数文件通常是存放在ASM磁盘的OCR投票盘里面,在ASM实例没有启动的情况下,是无法正常去读取修改的,这时候就需要我们通过一个临时的参数文件启动ASM实例,再去读取修改参数文件。
本文主要讲述如何通过一个临时的参数文件启动ASM实例并读取修改ASM参数文件。
操作步骤:
首先,我们通过修改内存参数sga_target大于sga_max_size,模拟ASM实例由于参数配置不合理导致无法正常启动的场景。
SQL> show parameter sga
NAME TYPE VALUE
-------------- ----------- ------------------------------
lock_sga boolean FALSE
sga_max_size big integer 1G
sga_target big integer 1G
SQL> alter system set sga_target=2G scope=spfile;
System altered.
重新启动集群,发现集群无法正常启动,ASM实例进程不存在。
---重新启动集群
[root@rac1 Desktop]# /u01/app/11.2.0/grid/bin/crsctl stop crs
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rac1'
CRS-2673: Attempting to stop 'ora.crsd' on 'rac1'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'rac1'
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN1.lsnr' on 'rac1'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'rac1'
CRS-2673: Attempting to stop 'ora.dbocs.ocsdbsrv.svc' on 'rac1'
CRS-2677: Stop of 'ora.LISTENER_SCAN1.lsnr' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.scan1.vip' on 'rac1'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'rac1' succeeded
CRS-2677: Stop of 'ora.dbocs.ocsdbsrv.svc' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.rac1.vip' on 'rac1'
CRS-2673: Attempting to stop 'ora.registry.acfs' on 'rac1'
CRS-2673: Attempting to stop 'ora.dbocs.db' on 'rac1'
CRS-2677: Stop of 'ora.scan1.vip' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.scan1.vip' on 'rac2'
CRS-2677: Stop of 'ora.rac1.vip' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.rac1.vip' on 'rac2'
CRS-2677: Stop of 'ora.dbocs.db' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'rac1'
CRS-2673: Attempting to stop 'ora.DATA2.dg' on 'rac1'
CRS-2673: Attempting to stop 'ora.FRA.dg' on 'rac1'
CRS-2673: Attempting to stop 'ora.OCRVOTE.dg' on 'rac1'
CRS-2677: Stop of 'ora.registry.acfs' on 'rac1' succeeded
CRS-2676: Start of 'ora.scan1.vip' on 'rac2' succeeded
CRS-2672: Attempting to start 'ora.LISTENER_SCAN1.lsnr' on 'rac2'
CRS-2677: Stop of 'ora.DATA2.dg' on 'rac1' succeeded
CRS-2677: Stop of 'ora.DATA.dg' on 'rac1' succeeded
CRS-2677: Stop of 'ora.FRA.dg' on 'rac1' succeeded
CRS-2676: Start of 'ora.rac1.vip' on 'rac2' succeeded
CRS-2676: Start of 'ora.LISTENER_SCAN1.lsnr' on 'rac2' succeeded
CRS-2677: Stop of 'ora.OCRVOTE.dg' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'rac1'
CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.ons' on 'rac1'
CRS-2677: Stop of 'ora.ons' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.net1.network' on 'rac1'
CRS-2677: Stop of 'ora.net1.network' on 'rac1' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'rac1' has completed
CRS-2677: Stop of 'ora.crsd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac1'
CRS-2673: Attempting to stop 'ora.evmd' on 'rac1'
CRS-2673: Attempting to stop 'ora.asm' on 'rac1'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'rac1'
CRS-2673: Attempting to stop 'ora.drivers.acfs' on 'rac1'
CRS-2677: Stop of 'ora.evmd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.mdnsd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'rac1'
CRS-2677: Stop of 'ora.drivers.acfs' on 'rac1' succeeded
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac1'
CRS-2677: Stop of 'ora.cssd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.crf' on 'rac1'
CRS-2677: Stop of 'ora.crf' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'rac1'
CRS-2677: Stop of 'ora.gipcd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gpnpd' on 'rac1'
CRS-2677: Stop of 'ora.gpnpd' on 'rac1' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'rac1' has completed
CRS-4133: Oracle High Availability Services has been stopped.
[root@rac1 Desktop]#
[root@rac1 Desktop]#
[root@rac1 Desktop]# /u01/app/11.2.0/grid/bin/crsctl start crs
CRS-4123: Oracle High Availability Services has been started.
---asm进程不存在
[root@rac1 Desktop]# ps -ef |grep -i asm
root 59689 43622 0 20:15 pts/0 00:00:00 grep -i asm
查看asm实例启动日志,没有输出日志,因为还没到实例启动,只是参数检查不通过。
tail -100f /u01/app/grid/diag/asm/+asm/+ASM1/trace/alert_+ASM1.log
###############只有实例shutdown的日志,没有启动日志
Received detach msg from inst 2 for dom 1
freeing rdom 3
Received detach msg from inst 2 for dom 3
freeing rdom 2
Received detach msg from inst 2 for dom 2
Sun Aug 14 20:13:14 2022
Stopping background process VKTM
Sun Aug 14 20:13:16 2022
freeing rdom 4
freeing rdom 0
Sun Aug 14 20:13:19 2022
Instance shutdown complete
这种情况下,只能通过集群ohasd agent服务下的oraagent_grid服务日志去查看报错原因,从日志里面我们看到ORA-00823: Specified value of sga_target greater than sga_max_size的报错。
tail -1000f /u01/app/11.2.0/grid/log/rac1/agent/ohasd/oraagent_grid/oraagent_grid.log
022-08-14 20:15:26.610: [ora.asm][550496000]{0:0:2} [start] InstAgent::start exception }
2022-08-14 20:15:26.611: [ora.asm][550496000]{0:0:2} [start] clsnUtils::error Exception type=2 string=
CRS-5017: The resource action "ora.asm start" encountered the following error:
ORA-00823: Specified value of sga_target greater than sga_max_size
. For details refer to "(:CLSN00107:)" in "/u01/app/11.2.0/grid/log/rac1/agent/ohasd/oraagent_grid//oraagent_grid.log".
2022-08-14 20:15:26.611: [ AGFW][550496000]{0:0:2} sending status msg [CRS-5017: The resource action "ora.asm start" encountered the following error:
ORA-00823: Specified value of sga_target greater than sga_max_size
. For details refer to "(:CLSN00107:)" in "/u01/app/11.2.0/grid/log/rac1/agent/ohasd/oraagent_grid//oraagent_grid.log".
] for start for resource: ora.asm 1 1
2022-08-14 20:15:26.611: [ora.asm][550496000]{0:0:2} [start] (:CLSN00107:) clsn_agent::start }
2022-08-14 20:15:26.611: [ AGFW][550496000]{0:0:2} Command: start for resource: ora.asm 1 1 completed with status: FAIL
知道报错原因之后,我们需要手动去修正参数文件里面的参数配置。
首先,我们需要把asm实例启动起来,里面参数文件存放在ASM磁盘里面,我们通过一个临时的简易参数文件启动ASM实例。
#注意asm_diskstring存储磁盘路径以及diagnostic_dest路径正确
vi /tmp/pfile.ora
*.asm_diskstring='/dev/mapper/*'
*.asm_power_limit=1
*.diagnostic_dest='/u01/app/grid'
*.instance_type='asm'
*.large_pool_size=12M
*.remote_login_passwordfile='EXCLUSIVE'
---通过pfile.ora启动ASM实例
[grid@rac1 ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.4.0 Production on Sun Aug 14 20:33:22 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL>
SQL>
SQL> startup pfile='/tmp/pfile.ora';
ASM instance started
Total System Global Area 1135747072 bytes
Fixed Size 2260728 bytes
Variable Size 1108320520 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled
SQL>
将原来的ASM实例参数文件转存到本地目录。
---ASM实例参数文件的路径存放在gpnp文件下面
#GPNP配置文件位于GRID_HOME/gpnp/<主机名>/profiles/peer/profile.xml
[grid@rac1 ~]$ cat /u01/app/11.2.0/grid/gpnp/rac1/profiles/peer/profile.xml
jU8ErYpd8GZ5bhomYa0RIJ0HNKU= rHGZmo8m6471g9wnsbNEPneABne/7O3rPhc4xrRA9Q69/PCR80oDJ4b0bDD1TFDKQVpDvc38RKJvR/0G+wfHt6XOvtZlQWPWVGiwJcEH5ylh742dR79kgpsxkc0nHbIJcwuS2PHoVUHcnp/SWCGV2r/HF9myE55U0PuF+bzKsvs=
---将ASM实例参数文件转存到本地目录
[grid@rac1 ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.4.0 Production on Sun Aug 14 20:45:24 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> create pfile='/tmp/initasm.ora' from spfile='+OCRVOTE/rac-cluster/asmparameterfile/registry.253.1112709717';
File created.
手动修正转存到本地目录的ASM参数文件。
vi /tmp/initasm.ora
+ASM1.__shared_pool_size=734003200
+ASM2.asm_diskgroups='DATA','FRA','DATA2'#Manual Mount
+ASM1.asm_diskgroups='DATA','FRA','DATA2'#Manual Mount
*.asm_diskstring='/dev/mapper/*'
*.asm_power_limit=1
+ASM2.db_cache_size=200m
+ASM1.db_cache_size=314572800
*.diagnostic_dest='/u01/app/grid'
*.instance_type='asm'
*.large_pool_size=12M
*.local_listener=''
*.memory_target=0
*.remote_listener='rac-scan:1521'
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_max_size=1073741824
---修正SGA_TARGET参数
*.sga_target=1G
+ASM1.shared_pool_size=200M
+ASM2.shared_pool_size=200M
再将修正后的ASM参数文件恢复到ASM目录里面。
---恢复到ASM目录里面,只需要使用create spfile的方式
SQL> create spfile='+OCRVOTE' from pfile='/tmp/initasm.ora';
File created.
---通过查看asm alert日志,我们可以发现,集群会自动将新的参数文件以及存储磁盘路径更新到gpnp文件里面。
Sun Aug 14 20:49:23 2022
NOTE: updated gpnp profile ASM SPFILE to
NOTE: updated gpnp profile ASM diskstring: /dev/mapper/*
NOTE: updated gpnp profile ASM diskstring: /dev/mapper/*
NOTE: updated gpnp profile ASM SPFILE to +OCRVOTE/rac-cluster/asmparameterfile/registry.253.1112734165
最后,再重新启动集群,ASM实例恢复正常。
[root@rac1 Desktop]# /u01/app/11.2.0/grid/bin/crsctl stop crs
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rac1'
CRS-2673: Attempting to stop 'ora.crsd' on 'rac1'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'rac1'
CRS-2673: Attempting to stop 'ora.rac2.vip' on 'rac1'
CRS-2673: Attempting to stop 'ora.registry.acfs' on 'rac1'
CRS-2673: Attempting to stop 'ora.dbocs.ocsdbsrv.svc' on 'rac1'
CRS-2673: Attempting to stop 'ora.oc4j' on 'rac1'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'rac1'
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN1.lsnr' on 'rac1'
CRS-2673: Attempting to stop 'ora.cvu' on 'rac1'
CRS-2677: Stop of 'ora.cvu' on 'rac1' succeeded
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'rac1' succeeded
CRS-2677: Stop of 'ora.LISTENER_SCAN1.lsnr' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.scan1.vip' on 'rac1'
CRS-2677: Stop of 'ora.rac2.vip' on 'rac1' succeeded
CRS-2677: Stop of 'ora.dbocs.ocsdbsrv.svc' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.dbocs.db' on 'rac1'
CRS-2673: Attempting to stop 'ora.rac1.vip' on 'rac1'
CRS-2677: Stop of 'ora.scan1.vip' on 'rac1' succeeded
CRS-2677: Stop of 'ora.dbocs.db' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'rac1'
CRS-2673: Attempting to stop 'ora.DATA2.dg' on 'rac1'
CRS-2673: Attempting to stop 'ora.FRA.dg' on 'rac1'
CRS-2673: Attempting to stop 'ora.OCRVOTE.dg' on 'rac1'
CRS-2677: Stop of 'ora.rac1.vip' on 'rac1' succeeded
CRS-2677: Stop of 'ora.DATA2.dg' on 'rac1' succeeded
CRS-2677: Stop of 'ora.FRA.dg' on 'rac1' succeeded
CRS-2677: Stop of 'ora.registry.acfs' on 'rac1' succeeded
CRS-2677: Stop of 'ora.DATA.dg' on 'rac1' succeeded
CRS-2677: Stop of 'ora.OCRVOTE.dg' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'rac1'
CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded
CRS-2677: Stop of 'ora.oc4j' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.ons' on 'rac1'
CRS-2677: Stop of 'ora.ons' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.net1.network' on 'rac1'
CRS-2677: Stop of 'ora.net1.network' on 'rac1' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'rac1' has completed
CRS-2677: Stop of 'ora.crsd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac1'
CRS-2673: Attempting to stop 'ora.evmd' on 'rac1'
CRS-2673: Attempting to stop 'ora.asm' on 'rac1'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'rac1'
CRS-2673: Attempting to stop 'ora.drivers.acfs' on 'rac1'
CRS-2677: Stop of 'ora.ctssd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.evmd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.mdnsd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'rac1'
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac1'
CRS-2677: Stop of 'ora.cssd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.crf' on 'rac1'
CRS-2677: Stop of 'ora.drivers.acfs' on 'rac1' succeeded
CRS-2677: Stop of 'ora.crf' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'rac1'
CRS-2677: Stop of 'ora.gipcd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.gpnpd' on 'rac1'
CRS-2677: Stop of 'ora.gpnpd' on 'rac1' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'rac1' has completed
CRS-4133: Oracle High Availability Services has been stopped.
[root@rac1 Desktop]# /u01/app/11.2.0/grid/bin/crsctl start crs
CRS-4123: Oracle High Availability Services has been started.
[root@rac1 Desktop]# ps -ef |grep -i ASM
grid 76659 1 0 20:54 ? 00:00:00 asm_pmon_+ASM1
grid 76661 1 0 20:54 ? 00:00:00 asm_psp0_+ASM1
grid 76663 1 2 20:54 ? 00:00:01 asm_vktm_+ASM1
grid 76667 1 0 20:54 ? 00:00:00 asm_gen0_+ASM1
grid 76669 1 0 20:54 ? 00:00:00 asm_diag_+ASM1
grid 76671 1 0 20:54 ? 00:00:00 asm_ping_+ASM1
grid 76673 1 0 20:54 ? 00:00:00 asm_dia0_+ASM1
grid 76675 1 0 20:54 ? 00:00:00 asm_lmon_+ASM1
grid 76677 1 0 20:54 ? 00:00:00 asm_lmd0_+ASM1
grid 76679 1 0 20:54 ? 00:00:00 asm_lms0_+ASM1
grid 76683 1 0 20:54 ? 00:00:00 asm_lmhb_+ASM1
grid 76685 1 0 20:54 ? 00:00:00 asm_mman_+ASM1
grid 76687 1 0 20:54 ? 00:00:00 asm_dbw0_+ASM1
grid 76689 1 0 20:54 ? 00:00:00 asm_lgwr_+ASM1
grid 76691 1 0 20:54 ? 00:00:00 asm_ckpt_+ASM1
grid 76693 1 0 20:54 ? 00:00:00 asm_smon_+ASM1
grid 76695 1 0 20:54 ? 00:00:00 asm_rbal_+ASM1
grid 76697 1 0 20:54 ? 00:00:00 asm_gmon_+ASM1
grid 76699 1 0 20:54 ? 00:00:00 asm_mmon_+ASM1
grid 76701 1 0 20:54 ? 00:00:00 asm_mmnl_+ASM1
grid 76703 1 0 20:54 ? 00:00:00 asm_lck0_+ASM1
grid 76847 1 0 20:55 ? 00:00:00 oracle+ASM1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
grid 77002 1 15 20:55 ? 00:00:06 oracle+ASM1_ocr (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
grid 77004 1 0 20:55 ? 00:00:00 asm_asmb_+ASM1
grid 77006 1 0 20:55 ? 00:00:00 oracle+ASM1_asmb_+asm1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
grid 77008 1 0 20:55 ? 00:00:00 asm_o000_+ASM1
grid 77011 1 0 20:55 ? 00:00:00 oracle+ASM1_o000_+asm1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
grid 77014 1 0 20:55 ? 00:00:00 asm_o001_+ASM1
grid 77081 1 0 20:55 ? 00:00:00 asm_fd00_+ASM1
grid 77303 1 0 20:55 ? 00:00:00 oracle+ASM1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
grid 77342 1 0 20:55 ? 00:00:00 oracle+ASM1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
grid 77352 1 0 20:55 ? 00:00:00 oracle+ASM1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
grid 77509 1 0 20:55 ? 00:00:00 oracle+ASM1_o001_+asm1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle 77618 1 0 20:55 ? 00:00:00 ora_asmb_dbocs1
grid 77624 1 2 20:55 ? 00:00:00 oracle+ASM1_asmb_dbocs1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
grid 77641 1 1 20:55 ? 00:00:00 oracle+ASM1_ocf0_dbocs1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
grid 77679 1 3 20:55 ? 00:00:00 oracle+ASM1_o000_dbocs1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
root 77774 43622 0 20:55 pts/0 00:00:00 grep -i ASM