Infrastructure at your Service

By Franck Pachot

.
In the previous blog post, to the question “where is the ASM SPFILE” I answered by running ‘asmcmd spget’. But this is available only if the ASM instance is started. If you have corrupted your SPFILE (and it’s easy to do it) you can start with a local PFILE and the CREATE SPFILE= FROM PFILE. But then you get the location of the local one you used. If you need to know the shared location, let’s see the different places where you can find it.

First I set the environment for the ASM instance.


[[email protected] ~]$ . oraenv <<< +ASM1
ORACLE_SID = [grid] ? The Oracle base has been set to /u01/app/grid

If the ASM instance is up you can get the SPFILE location from ASMCMD:


[[email protected] ~]$ asmcmd spget
+CRS_DG/ws-dbi-scan1/ASMPARAMETERFILE/registry.253.905527691

or from SQL*Plus:


[[email protected] ~]$ sqlplus -s / as sysasm
show parameter spfile
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +CRS_DG/ws-dbi-scan1/ASMPARAME
                                                 TERFILE/registry.253.905527691

If the ASM instance us up but started with another SPFILE (or PFILE) you can search for a SPFILE in all diskgroups:


[[email protected] ~]$ asmcmd find --type PARAMETERFILE '*' '*'
+CRS_DG/_MGMTDB/PARAMETERFILE/spfile.268.905529015
+DATA/RACDB/PARAMETERFILE/spfile.269.906247759
+DATA/RACDB/spfileRACDB.ora

But if ASM instance is not up, let’s see where we can find its location.

From GPnP tool

The cluster needs to know the SPFILE location in order to start the ASM instance, and for this purpose, location is stored in the GPnP profile


[[email protected] ~]$ gpnptool get -o- | xmllint --format - | grep SPFile
Success.
  <orcl:ASM-Profile id="asm" DiscoveryString="" SPFile="+CRS_DG/ws-dbi-scan1/ASMPARAMETERFILE/registry.253.905527691" Mode="remote"/>

Of course you can get it directly from the GPnP profile xml file


[[email protected] ~]$ xmllint --shell $ORACLE_HOME/gpnp/$HOSTNAME/profiles/peer/profile.xml <<< "cat //*[@SPFile]/@SPFile"
 SPFile="+CRS_DG/ws-dbi-scan1/ASMPARAMETERFILE/registry.253.905527691"

If you messed-up the GPnP profile, you may want to find the previous value.

From alert.log

If the ASM instance has been startup previously, which is probably the case, you can see the location of SPFILE in the alert.log:


[[email protected] ~]$ adrci exec="set home +asm ; show alert -tail 1000" | grep "parameter setting"
Using parameter settings in server-side spfile +CRS_DG/ws-dbi-scan1/ASMPARAMETERFILE/registry.253.905527691
Using parameter settings in server-side spfile +CRS_DG/ws-dbi-scan1/ASMPARAMETERFILE/registry.253.905527691
Using parameter settings in server-side spfile +CRS_DG/ws-dbi-scan1/ASMPARAMETERFILE/registry.253.905527691
Using parameter settings in server-side spfile +CRS_DG/ws-dbi-scan1/ASMPARAMETERFILE/registry.253.905527691

$ORACLE_HOME/dbs

What is important to know is that there is nothing in $ORACLE_HOME/dbs


[[email protected] ~]$ ls $ORACLE_HOME/dbs
ab_+ASM1.dat  hc_+APX1.dat  hc_+ASM1.dat  hc_-MGMTDB.dat  id_+ASM1.dat  init-MGMTDB.ora  init.ora  lk_MGMTDB

and the ASM instance startup looks up there only if not found from the GPnP profile.

Backup the ASM SPFILE

It’s always a good idea to backup the SPFILE, in the same way you backup the OCR, and GPnP profile.


[[email protected] ~]$ asmcmd spbackup +CRS_DG/ws-dbi-scan1/ASMPARAMETERFILE/registry.253.905527691 /tmp/asmspfile.bak

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Franck Pachot
Franck Pachot

Principal Consultant / Database Evangelist
Oracle ACE Director, Oracle Database OCM 12c
AWS Database Specialty certified, AWS Community Builder
Oak Table member

RSS for this blog: feed
Twitter: @FranckPachot
LinkedIn : www.linkedin.com/in/franckpachot
Podcast en français: DBPod