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
Overview – steps to read an ASM Spfile
- Use Pnp play tool: gpnptool getpval -asm_dis to read ASM disk discovery path
- Scan all available ASM disk header to find ASM disks having a spfile reference
- Read the related block and dump the SPfile entries
Read ASM disk discovery string from profile.xml
Read Plug and Play XML file read ASM pfile info and ASM disk discovery string:
# $GRID_HOME/bin/gpnptool getpval -asm_spf -p=/u01/app/11203/grid/gpnp/grac1/profiles/peer/profile.xml
Warning: some command line parameters were defaulted. Resulting command line:
/u01/app/11203/grid/bin/gpnptool.bin getpval -asm_spf -p=/u01/app/11203/grid/gpnp/grac1/profiles/peer/profile.xml -o-
+DATA/grace2/asmparameterfile/registry.253.821039237
-> Diskgroup DATA is used
Read the ASM disk discovery string
$GRID_HOME/bin/gpnptool getpval -asm_dis -p=/u01/app/11203/grid/gpnp/grac1/profiles/peer/profile.xml
Warning: some command line parameters were defaulted. Resulting command line:
/u01/app/11203/grid/bin/gpnptool.bin getpval -asm_dis -p=/u01/app/11203/grid/gpnp/grac1/profiles/peer/profile.xml -o-
ASM discovery disk string : dev/oracleasm/disks/*
Use the discoverd ASM disk string and user kfed to find a disk with a SPILE
# ls /dev/oracleasm/disks/*
/dev/oracleasm/disks/ACFS_DATA /dev/oracleasm/disks/DATA2 /dev/oracleasm/disks/OCR1 /dev/oracleasm/disks/OCR3
/dev/oracleasm/disks/DATA1 /dev/oracleasm/disks/DATA3 /dev/oracleasm/disks/OCR2
Let's scan the disks until we find a disk with SPfile location
# $GRID_HOME/bin/kfed read /dev/oracleasm/disks/DATA1 | egrep 'spf|ausize'
kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000
kfdhdb.spfile: 0 ; 0x0f4: 0x00000000
kfdhdb.spfflg: 0 ; 0x0f8: 0x00000000
spfflg=0 --> No spfile
# $GRID_HOME/bin/kfed read /dev/oracleasm/disks/DATA2 | egrep 'spf|ausize'
kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000
kfdhdb.spfile: 59 ; 0x0f4: 0x0000003b
kfdhdb.spfflg: 1 ; 0x0f8: 0x00000001
spfflg=1 --> SPfile at block 59 - Read the block and check it:
Read the block with dd and use strings to extract some spfile data
# dd if=/dev/oracleasm/disks/DATA2 of=SPFile_from_ASM.dat bs=1M count=1 skip=59
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.00882297 s, 119 MB/s
# strings SPFile_from_ASM.dat
+ASM1.asm_diskgroups='OCR','ACFS'#Manual Mount
+ASM2.asm_diskgroups='ACFS'#Manual Mount
*.asm_diskstring='/dev/oracleasm/disks/*'
*.asm_power_limit=1
*.diagnostic_dest='/u01/app/grid'
*.instance_type='asm'
*.large_pool_size=12M
*.remote_login_passwordfile='EXCLUSIVE'
--> Now we have read the ASM PFile and in a similar ASM can startup the instance
References: