首页 / 数据库 / MySQL / 11G ASM磁盘组不能自动MOUNT处理
今天启动了一下ASM,发现只挂载了一个SYS_DG磁盘组(用于存放OCR和VOTING DISK信息),另外两个磁盘组DATA_DG,DG_FRA都没有mount。
环境:OS=RHEL 6 DB=Oracle11GR2[grid@myrac1 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.DATA_DG.dg ora....up.type OFFLINE OFFLINE
ora.DG_FRA.dg ora....up.type OFFLINE OFFLINE
ora....ER.lsnr ora....er.type ONLINE ONLINE myrac1
ora.SYS_DG.dg ora....up.type ONLINE ONLINE myrac1
ora.asm ora.asm.type ONLINE ONLINE myrac1
ora.cssd ora.cssd.type ONLINE ONLINE myrac1
ora.diskmon ora....on.type ONLINE ONLINE myrac1
ora.hjj.db ora....se.type OFFLINE OFFLINE
查看参数disk_groups发现没有值,按理来说应该是这三个磁盘组。
SQL> show parameter diskNAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups string
asm_diskstring string
进行修改
[grid@myrac1 ~]$ sqlplus / as sysasm
SQL> startup nomount
ASM instance startedTotal System Global Area 284565504 bytes
Fixed Size 1336036 bytes
Variable Size 258063644 bytes
ASM Cache 25165824 bytes
SQL> alter system set asm_diskgroups=sys_dg,data_dg,dg_fra scope=spfile;
alter system set asm_diskgroups=sys_dg,data_dg,dg_fra scope=spfile
*
ERROR at line 1:
ORA-32000: write to SPFILE requested but SPFILE is not modifiable
SQL> !oerr ora 32000
32000, 00000, "write to SPFILE requested but SPFILE is not modifiable"
// *Cause: An ALTER SYSTEM command or an internal self-tuning mechanism
// requested a write to the SPFILE but the SPFILE was not modifiable.
// *Action: Perform an in-memory parameter update only.
提示只能在memory中进行修改,尝试修改
SQL> alter system set asm_diskgroups=sys_dg,data_dg,dg_fra scope=memory;System altered.
是可以修改,但是没办法永久保存,要修改的是spfile中的disk_groups参数,让ASM实例每次启动都能加载所有的diskgroup。
那问题就是如何修改spfile中的asm_diskgroups参数
通过create pfile 然后修改pfile,再通过pfile创建spfile,重启实例即可。SQL> show parameter pfileNAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +SYS_DG/asm/asmparameterfile/registry.253.837910359
SQL> select instance_name,host_name,version,status from v$instance;INSTANCE_NAME HOST_NAME VERSION STATUS
---------------- ---------------------------------------------------------------- ----------------- ------------
+ASM myrac1.oracle.com 11.2.0.1.0 STARTEDSQL> create pfile="/g01/app/grid/product/11.2.0/grid/dbs/asmpfile.ora" from spfile;File created.
[grid@myrac1 dbs]$ vi asmpfile.ora
+ASM.__oracle_base="/g01/app/grid"#ORACLE_BASE set from in memory value
+ASM.asm_diskgroups="SYS_DG,DATA_DG,DG_FRA"#Manual Mount 不能在这里直接修改
*.asm_power_limit=1
*.diagnostic_dest="/g01/app/grid"
*.instance_type="asm"
*.large_pool_size=12M
*.remote_login_passwordfile="EXCLUSIVE"
~
SQL> create spfile from pfile="/g01/app/grid/product/11.2.0/grid/dbs/asmpfile.ora";File created.
SQL> startup
ORA-01078: failure in processing system parameters
ORA-62001: value for parameter cannot contain a comma
SQL> startup pfile="/g01/app/grid/product/11.2.0/grid/dbs/asmpfile.ora";
ORA-62001: value for parameter cannot contain a comma
SQL> startup
ASM instance startedTotal System Global Area 284565504 bytes
Fixed Size 1336036 bytes
Variable Size 258063644 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
发现磁盘组DATA_DG,DG_FRA还是没有Mount
[grid@myrac1 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.DATA_DG.dg ora....up.type OFFLINE OFFLINE
ora.DG_FRA.dg ora....up.type OFFLINE OFFLINE
ora....ER.lsnr ora....er.type ONLINE ONLINE myrac1
ora.SYS_DG.dg ora....up.type ONLINE ONLINE myrac1
ora.asm ora.asm.type ONLINE ONLINE myrac1
ora.cssd ora.cssd.type ONLINE ONLINE myrac1
ora.diskmon ora....on.type ONLINE ONLINE myrac1
ora.hjj.db ora....se.type OFFLINE OFFLINE
只能以这种方式进行asm_diskgroups参数的修改
SQL> alter system set asm_diskgroups=sys_dg,data_dg,dg_fra scope=spfile sid="+ASM";System altered.SQL> select status from v$instance;STATUS
------------
STARTEDSQL> shutdown immediate
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup
ASM instance startedTotal System Global Area 284565504 bytes
Fixed Size 1336036 bytes
Variable Size 258063644 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
SQL> !
[grid@myrac1 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.DATA_DG.dg ora....up.type ONLINE ONLINE myrac1
ora.DG_FRA.dg ora....up.type ONLINE ONLINE myrac1
ora....ER.lsnr ora....er.type ONLINE ONLINE myrac1
ora.SYS_DG.dg ora....up.type ONLINE ONLINE myrac1
ora.asm ora.asm.type ONLINE ONLINE myrac1
ora.cssd ora.cssd.type ONLINE ONLINE myrac1
ora.diskmon ora....on.type ONLINE ONLINE myrac1
ora.hjj.db ora....se.type OFFLINE OFFLINE
SQL> show parameter pfileNAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /g01/app/grid/product/11.2.0/grid/dbs/spfile+ASM.ora
[grid@myrac1 dbs]$ mv spfile+ASM.ora spfile+ASM.ora.bak
[grid@myrac1 dbs]$ ls
20140219 ab_+ASM.dat asmpfile.ora hc_+ASM.dat init.ora orapw+ASM peshm_+ASM_1 spfile+ASM.ora.bak
SQL> shutdown immediate
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup
ORA-00099: warning: no parameter file specified for ASM instance
ASM instance startedTotal System Global Area 284565504 bytes
Fixed Size 1336036 bytes
Variable Size 258063644 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted
发现使用的$CRS_HOME/dbs/spfile+ASM.ora参数文件,而不是磁盘组SYS_DG上的参数文件。
可以让asm实例启动的时候读取磁盘组上的spfile,步骤如下:
SQL> show parameter spfileNAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /g01/app/grid/product/11.2.0/grid/dbs/spfile+ASM.ora
SQL> startup
ASM instance startedTotal System Global Area 284565504 bytes
Fixed Size 1336036 bytes
Variable Size 258063644 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
SQL> !crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.DATA_DG.dg ora....up.type OFFLINE OFFLINE
ora.DG_FRA.dg ora....up.type OFFLINE OFFLINE
ora....ER.lsnr ora....er.type ONLINE ONLINE myrac1
ora.SYS_DG.dg ora....up.type ONLINE ONLINE myrac1
ora.asm ora.asm.type ONLINE ONLINE myrac1
ora.cssd ora.cssd.type ONLINE ONLINE myrac1
ora.diskmon ora....on.type ONLINE ONLINE myrac1
ora.hjj.db ora....se.type OFFLINE OFFLINE SQL> create spfile="+SYS_DG" from pfile="/g01/app/grid/product/11.2.0/grid/dbs/asmpfile.ora";File created.SQL> shutdown immediate
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup
ASM instance startedTotal System Global Area 284565504 bytes
Fixed Size 1336036 bytes
Variable Size 258063644 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
SQL> !crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.DATA_DG.dg ora....up.type OFFLINE OFFLINE
ora.DG_FRA.dg ora....up.type OFFLINE OFFLINE
ora....ER.lsnr ora....er.type ONLINE ONLINE myrac1
ora.SYS_DG.dg ora....up.type ONLINE ONLINE myrac1
ora.asm ora.asm.type ONLINE ONLINE myrac1
ora.cssd ora.cssd.type ONLINE ONLINE myrac1
ora.diskmon ora....on.type ONLINE ONLINE myrac1
ora.hjj.db ora....se.type OFFLINE OFFLINE SQL> alter system set asm_diskgroups=sys_dg,data_dg,dg_fra scope=spfile sid="+ASM";System altered.文件如下:ASMCMD> ls
DATA_DG/
DG_FRA/
SYS_DG/
ASMCMD> cd sys_dg
ASMCMD> ls
ASM/
ASMCMD> cd asm
ASMCMD> ls
ASMPARAMETERFILE/
ASMCMD> cd asmparameterfile
ASMCMD> ls
REGISTRY.253.840236163ASMCMD> pwd
+sys_dg/asm/asmparameterfileSQL> show parameter spfileNAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +SYS_DG/asm/asmparameterfile/r
egistry.253.840236163
SQL> shutdown immediate
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup
ASM instance startedTotal System Global Area 284565504 bytes
Fixed Size 1336036 bytes
Variable Size 258063644 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
SQL> show parameter spfileNAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +SYS_DG/asm/asmparameterfile/registry.253.840236163
SQL> show parameter diskgroupsNAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups string SYS_DG, DATA_DG, DG_FRA
SQL> !crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.DATA_DG.dg ora....up.type ONLINE ONLINE myrac1
ora.DG_FRA.dg ora....up.type ONLINE ONLINE myrac1
ora....ER.lsnr ora....er.type ONLINE ONLINE myrac1
ora.SYS_DG.dg ora....up.type ONLINE ONLINE myrac1
ora.asm ora.asm.type ONLINE ONLINE myrac1
ora.cssd ora.cssd.type ONLINE ONLINE myrac1
ora.diskmon ora....on.type ONLINE ONLINE myrac1
ora.hjj.db ora....se.type OFFLINE OFFLINE
注意:asmpfile.ora中的+ASM.asm_diskgroups="SYS_DG" #Manual Mount,不能添加DATA_DG,DG_FRA进去,否则创建spfile报错。只能再通过alter system进行修改。
总结:在NOMOUNT阶段oracle根据参数文件来分配内存空间及启动后台进程,这个时候磁盘组都没有加载,但是oracle的spfile是直接从磁盘读取的,与SYS_DG是否MOUNT没关系。更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12本文永久更新链接地址