In a database that is residing in a file system it is easy to replace the spfile with
create spfile from pfile
when the database is started with a pfile. But note the following when replacing a spfile that resides in ASM.
When the DB is created the spfile inside ASM is as below. spfile.260.714060565 is the exact spfile and spfilerac11g.ora is alias refering it
ASMCMD> ls -l
Type Redund Striped Time Sys Name
Y ARCHIVELOG/
Y CONTROLFILE/
Y DATAFILE/
Y ONLINELOG/
Y PARAMETERFILE/
Y TEMPFILE/
N spfilerac11g.ora => +DATA/RAC11G/PARAMETERFILE/spfile.260.714060565
Now create a pfile and start the DB using it
SQL> startup nomount pfile=pfile.ora
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2162280 bytes
Variable Size 385876376 bytes
Database Buffers 230686720 bytes
Redo Buffers 7602176 bytes
Create the spfile with the usual command try to start the DB
SQL> create spfile='+DATA' from pfile;
File created.
SQL> startup force;
The startup command will not return. Looking inside the ASM you will see the following
ASMCMD> ls -l
Type Redund Striped Time Sys Name
Y ARCHIVELOG/
Y CONTROLFILE/
Y DATAFILE/
Y ONLINELOG/
Y PARAMETERFILE/
Y TEMPFILE/
N spfilerac11g.ora => +DATA/RAC11G/PARAMETERFILE/spfile.260.714060565
ASMCMD> ls -l parameterfile
Type Redund Striped Time Sys Name
PARAMETERFILE UNPROT COARSE APR 28 23:00:00 Y spfile.260.714060565
PARAMETERFILE UNPROT COARSE APR 29 00:00:00 Y spfile.393.717552031
The alias is still refering the old spfile. Rectifiy this as follows
ASMCMD> rmalias spfilerac11g.ora
ASMCMD> mkalias +DATA/RAC11G/PARAMETERFILE/spfile.393.717552031 spfilerac11g.ora
ASMCMD> ls -l
Type Redund Striped Time Sys Name
Y ARCHIVELOG/
Y CONTROLFILE/
Y DATAFILE/
Y ONLINELOG/
Y PARAMETERFILE/
Y TEMPFILE/
N spfilerac11g.ora => +DATA/RAC11G/PARAMETERFILE/spfile.393.717552031
Try starting the DB and it would still hang. Problem lies how the spfile was created. When creating the spfile specify the full path of the creating pfile
create spfile='+DATA' from pfile='/home/oracle/asanga/pfile.ora';
Replace alias and start the DB
ASMCMD> ls parameterfile
spfile.260.714060565
spfile.393.717552031
spfile.394.717553085
ASMCMD> rmalias spfilerac11g.ora
ASMCMD> mkalias +DATA/RAC11G/PARAMETERFILE/spfile.394.717553085 spfilerac11g.ora
ASMCMD> ls -l
Type Redund Striped Time Sys Name
Y ARCHIVELOG/
Y CONTROLFILE/
Y DATAFILE/
Y ONLINELOG/
Y PARAMETERFILE/
Y TEMPFILE/
N spfilerac11g.ora => +DATA/RAC11G/PARAMETERFILE/spfile.394.717553085
SQL> startup force;
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2162280 bytes
Variable Size 385876376 bytes
Database Buffers 230686720 bytes
Redo Buffers 7602176 bytes
Database mounted.
Database opened.