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 disk
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups string
asm_diskstring string
進行修改
[grid@myrac1 ~]$ sqlplus / as sysasm
SQL> startup nomount
ASM instance started
Total 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 pfile
NAME 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 STARTED
SQL> 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 started
Total 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
------------
STARTED
SQL> shutdown immediate
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup
ASM instance started
Total 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 pfile
NAME 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 started
Total 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 spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /g01/app/grid/product/11.2.0/grid/dbs/spfile+ASM.ora
SQL> startup
ASM instance started
Total 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 started
Total 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.840236163
ASMCMD> pwd
+sys_dg/asm/asmparameterfile
SQL> show parameter spfile
NAME 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 started
Total System Global Area 284565504 bytes
Fixed Size 1336036 bytes
Variable Size 258063644 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +SYS_DG/asm/asmparameterfile/registry.253.840236163
SQL> show parameter diskgroups
NAME 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沒關係。