<<Back to Oracle ASM Main Page
What is ASM SPFile
SPFILE of an ASM instance is a file which stores the ASM configuration parameters (in key value pair). Oracle reads this configuration file to start the ASM instance.Starting with ASM version 11.2, the ASM spfile can be stored in an ASM disk group. When installing Oracle ASM in an Oracle Restart (standalone) configuration or in RAC Configuration, Oracle Universal Installer (OUI) creates a separate server parameter file (SPFILE) and password file for the Oracle ASM instance. The ASM SPFILE is stored in a disk group during installation.
What is the Search Order of ASM SPFile
When an Oracle ASM instance searches for an initialization parameter file, the search order is:1> The location of the initialization parameter file specified in the Grid Plug and Play (GPnP) profile (only in RAC)
2> SPFILE in the Oracle ASM instance home eg $ORACLE_HOME/dbs/spfile+ASM.ora
3> PFILE in the Oracle ASM instance home
Since starting with ASM version 11.2, the ASM spfile can be stored in an ASM disk group. Oracle finds the spfile info from GPnP profile in case of RAC but in case of Grid Infrastructure for Standalone Environment there is no (GPnP) profile (as you can in pic below), and in this scenario how Oracle locates the spfile stored in diskgroup even when ASM is not started is a very obvious question to ask. Lets find the answer.
GI Standalone don't have GPnP Profile
$ gpnptool get
How ASM locates the spfile stored in ASM Diskgroup in Grid Infrastructure Standalone Environment
Answer is Oracle Local Registry (OLR). Yes the spfile location of an ASM instance in case if Grid Infrastructure Standalone installation is stored in ora.asm resource in OLR.$ crsctl status res -t |grep -i ora.asm
$ crsctl stat res ora.asm -p | egrep "ASM_DISKSTRING|SPFILE"
As you can see when ASM starts it gets the SPFILE location from OLR. As you can also see the SPFILE is located in ASM Diskgroup which is not yet mounted so again the question is how Oracle can read the content of spfile to start the ASM instance.
How Oracle Reads the Content of SPFILE (Stored in ASM Diskgroup ) and Starts ASM Instance Even when the Diskgroup is not Mounted
The trick is in ASM disk header. To support the ASM Spfile in ASM Diskgroup two new fields are added in ASM header metadatakfdhdb.spfflag: If the value is 1 the asm apfile is on this disk.
kfdhdb.spfile: Spfile is located in this allocation unit
Since the Spfile in my case (as shown above) is located in DG_TEST_DATA diskgroup so let us find the disks in this DG and try to read the header of each disks using kfed utility
$ asmcmd lsdsk -G DG_TEST_DATA --suppressheader
AFD:DATA01<= I have only 1 disk in the DG
$ kfed read AFD:DATA01 | grep spf
kfdhdb.spfile: 60 ; 0x0f4: 0x0000003c<= spfile is located at allocation unit 60 on this disk.
kfdhdb.spfflg: 1 ; 0x0f8: 0x00000001<= the Disk hold Spfile.
Now let dump the content of disk /dev/xvdg using dd at disk offset position 60
$ kfed read AFD:DATA01 | grep ausize
kfdhdb.ausize: 1048576 ; 0x0bc: 0x00100000
as root
# dd if=AFD:DATA01 bs=1048576 skip=60 count=1 | strings
And now we know that oracle gets the Spfile location from OLR it. It locates the position of SPfile in disk and reads the spfile content even when the diskgroup is offline and this is how oracle stores and usages the spfile.
Where is my ASM SPFile and How do I find it
When ASM Instance is upusing asmcmd
$ asmcmd spget
Using SQLPLUS
When ASM Instance is down
Using OLR
One can read the SPfile location from OLR as show in the post above
$ crsctl stat res ora.asm -p | egrep "ASM_DISKSTRING|SPFILE"
Using ASM Alert Log
Very informative ! Thanks
ReplyDeleteExact to the point article. Well crafted and clear.
ReplyDelete