Blog

How to change the SPFILE location for ASM

By Mario Barduchi

Hello everyone

I always like to change the location from my SPFILE for inside my ASM disks. It’s so easy and it’s a good practice for me.

Let’s get started.

— Show spfile location

SQL> show parameter spfile

NAME TYPE VALUE
——– ——— ———————————————————–
spfile string /u01/app/oracle/product/12.2.0/dbhome_1/dbs/spfileorcl.ora

— Create pfile, only for security

SQL> create pfile=’/tmp/orcl.pfile’ from spfile;
File created.

— Create SPFILE inside ASM

SQL> create spfile=’+DATA/orcl/spfileorcl.ora’ from pfile=’/tmp/orcl.pfile’;
File created.

Important: In fact, the command create the SPFILE inside directory “+DATA/orcl/PARAMETERFILE” and create a alias in “+DATA/orcl/”.

SPFILE: +DATA/orcl/PARAMETERFILE/spfile.402.978161901
ALIAS: +DATA/orcl/spfileorcl.ora

— Check the new file

su – grid
asmcmd -p
cd +DATA/orcl/
ls -l

cd +DATA/orcl/PARAMETERFILE
ls -l

— Create init with new spfile location

su – oracle
cd $ORACLE_HOME/dbs
mv spfileorcl.ora spfileorcl.ora-OLD

vim initorcl.ora
SPFILE=’+DATA/orcl/spfileorcl.ora’

Startup database
SQL> startup

— Show new spfile location
SQL> show parameter spfile

NAME TYPE VALUE
————– ———– ——————————
spfile string +DATA/orcl/spfileorcl.ora

Edited:

My friend Oracle ACE Franky Weber Faust, reminded me for modify the spfile with SRVCTL for register the new path.

srvctl modify database -d orcl -p ‘+DATA/orcl/spfileorcl.ora’

That’s it. Very easy.

Mario

Fonte: ORADICAS