Using ASM spfile

Locate/Identify ASM Spfile location

ASMCMD> spget 
+DATA/grac4/asmparameterfile/registry.253.825944079

$ $GRID_HOME/bin/gpnptool get
-->  SPFile="+DATA/grac4/asmparameterfile/registry.253.825944079"

ASM SPIFLE search order :
When an Oracle ASM instance searches for an initialization parameter file, the search order is:
    The location of the initialization parameter file specified in the Grid Plug and Play (GPnP) profile.
    If the location has not been set in the GPnP profile, then the search order changes to:
        SPFILE in the Oracle ASM instance home (e.g. $ORACLE_HOME/dbs/spfile+ASM.ora)
        PFILE in the Oracle ASM instance home

Has your GPnP defined an ASM SPFILE ?
[root@grac41 Desktop]#  $GRID_HOME/bin/gpnptool get 2>/dev/null |  xmllint --format -
...
  <orcl:CSS-Profile id="css" DiscoveryString="+asm" LeaseDuration="400"/>
  <orcl:ASM-Profile id="asm" DiscoveryString="/dev/asm*" SPFile="+OCR/grac4/asmparameterfile/spfileASM.ora"/>

Recreate and fixing an ASM SPFILE

Create an PFILE from SPFile 
SQL> connect / as sysasm
SQL> create pfile='/home/grid/SPFile/spfileasm.ora' from spfile;

--> Fix any error or parameters in file spfileasm.ora
A typical pfile could look like:
$ cat  spfileasm.ora
+ASM1.__oracle_base='/u01/app/grid'#ORACLE_BASE set from in memory value
+ASM2.__oracle_base='/u01/app/grid'#ORACLE_BASE set from in memory value
+ASM3.__oracle_base='/u01/app/grid'#ORACLE_BASE set from in memory value
+ASM1.asm_diskgroups='OCR','SSD','FRA','DATA','OPENFILER_DG','ASMLIB_DG'#Manual Mount
+ASM2.asm_diskgroups='OCR','SSD','FRA','DATA','OPENFILER_DG','ASMLIB_DG'#Manual Mount
+ASM3.asm_diskgroups='OCR','SSD','FRA','DATA','OPENFILER_DG','ASMLIB_DG'#Manual Mount
*.asm_diskstring='/dev/asm*','/dev/oracleasm/disks/*'
*.asm_power_limit=1
*.diagnostic_dest='/u01/app/grid'
*.instance_type='asm'
*.large_pool_size=12M
*.remote_login_passwordfile='EXCLUSIVE'

Check current SPFile status asmcmd spget
+OCR/grac4/asmparameterfile/spfileCopyASM.ora
$ asmcmd ls -l +OCR/grac4/asmparameterfile/spfileCopyASM.ora
Type              Redund  Striped  Time             Sys  Name
                                                    N    spfileCopyASM.ora => +OCR/grac4/asmparameterfile/REGISTRY.253.842605053
$GRID_HOME/bin/gpnptool get 2>/dev/null  |  xmllint --format - | egrep 'SPFile'
  <orcl:ASM-Profile id="asm" DiscoveryString="/dev/asm*,/dev/oracleasm/disks/*" SPFile="+OCR/grac4/asmparameterfile/spfileCopyASM.ora"/>

Try to recreate SPFile on +OCR DG
SQL>  create spfile='+OCR' from pfile='/home/grid/SPFile/spfileasm.ora';
 create spfile='+OCR' from pfile='/home/grid/SPFile/spfileasm.ora'
*
ERROR at line 1:
ORA-17502: ksfdcre:4 Failed to create file +OCR
ORA-15268: internal Oracle file +OCR.253.1 already exists.
--> Old spfile on +OCR DG blocks recreating ASM SPFile

Recreate ASM SPFILE on a new DG
SQL>  create spfile='+DATA'  from pfile='/home/grid/SPFile/spfileasm.ora';
File created.
$ asmcmd spget
+DATA/grac4/asmparameterfile/registry.253.850816451

Verify profile.xml on all nodes :  ProfileSequence  and SPFILE 
grac41.example.com
  ProfileSequence="12" ClusterName="grac4"
grac42.example.com
  ProfileSequence="12" ClusterName="grac4"
grac43.example.com
  ProfileSequence="12" ClusterName="grac4"
--> Profile.xml extract 
grac41.example.com
  <orcl:ASM-Profile id="asm" DiscoveryString="/dev/asm*,/dev/oracleasm/disks/*" SPFile="+DATA/grac4/asmparameterfile/registry.253.850816451"/>
grac42.example.com
  <orcl:ASM-Profile id="asm" DiscoveryString="/dev/asm*,/dev/oracleasm/disks/*" SPFile="+DATA/grac4/asmparameterfile/registry.253.850816451"/>
grac43.example.com
  <orcl:ASM-Profile id="asm" DiscoveryString="/dev/asm*,/dev/oracleasm/disks/*" SPFile="+DATA/grac4/asmparameterfile/registry.253.850816451"/>

Copy SPFile back to +OCR disk group 
ASMCMD>  spcopy -u +DATA/grac4/ASMPARAMETERFILE/REGISTRY.253.850816451 +OCR
ORA-15056: additional error message
ORA-17502: ksfdcre:4 Failed to create file +OCR/REGISTRY.253.850816451
ORA-15268: internal Oracle file +OCR.253.1 already exists.
ORA-06512: at line 7 (DBD ERROR: OCIStmtExecute)

--> Remove old SPFILE from +OCR DG
ASMCMD> cd +OCR/grac4/asmparameterfile/
ASMCMD> ls
REGISTRY.253.842605053
spfileCopyASM.ora
ASMCMD> rm REGISTRY.253.842605053
ASMCMD> ls
ASMCMD> spcopy -u +DATA/grac4/ASMPARAMETERFILE/REGISTRY.253.850816451 +OCR
ORA-15056: additional error message
ORA-17502: ksfdcre:4 Failed to create file +OCR/REGISTRY.253.850816451
ORA-15177: cannot operate on system aliases
ORA-06512: at line 7 (DBD ERROR: OCIStmtExecute)

ASMCMD> spcopy -u +DATA/grac4/ASMPARAMETERFILE/REGISTRY.253.850816451 +OCR/grac4/asmparameterfile/spfileASM.ora
ASMCMD> spget
+OCR/grac4/asmparameterfile/spfileASM.ora
ASMCMD> ls -l +OCR/grac4/asmparameterfile/
Type              Redund  Striped  Time             Sys  Name
ASMPARAMETERFILE  MIRROR  COARSE   JUN 21 10:00:00  Y    REGISTRY.253.850819057
                                                    N    spfileASM.ora => +OCR/grac4/asmparameterfile/REGISTRY.253.850819057

Copy spfile to a different diskgroup and update GPnP profile

Copy spfile from +DATA to +OCR diskgroup 
ASMCMD>  spcopy -u +DATA/grac4/asmparameterfile/registry.253.825944079 +OCR
ORA-15056: additional error message
ORA-17502: ksfdcre:4 Failed to create file +OCR/registry.253.825944079
ORA-15177: cannot operate on system aliases
ORA-06512: at line 7 (DBD ERROR: OCIStmtExecute)

--> Create directory and provide a name for our ASM spfile
ASMCMD> mkdir  +OCR/grac4/asmparameterfile/
ASMCMD> spcopy -u   +DATA/grac4/asmparameterfile/registry.253.825944079 +OCR/grac4/asmparameterfile/spfileCopyASM.ora

Verify that our spfile location is valid
ASMCMD>  spget
+OCR/grac4/asmparameterfile/spfileCopyASM.ora
Verify that GPnP profile is udpdated 
$ $GRID_HOME/bin/gpnptool get
-->  SPFile="+OCR/grac4/asmparameterfile/spfileCopyASM.ora"

Make a copy/backup of the new spfile to the filesystem without updating GPnP profile :

ASMCMD> spcopy +OCR/grac4/asmparameterfile/spfileCopyASM.ora  $ORACLE_HOME/dbs/spfileCopyASM.ora

Verify that GPnP profile isn'T updated
$ $GRID_HOME/bin/gpnptool get
-->  SPFile="+OCR/grac4/asmparameterfile/spfileCopyASM.ora"

--> Now restart your cluster 

Reference

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>