Skip to content

How Srvctl Modify Database SPFILE

  • by

Srvctl Modify Database SPFILE

We have changed the location of password file by srvctl modify database in the previous post, here we plan to change the SPFILE location of a RAC DB. Let's see current location of SPFILE.

[oracle@node1 ~]$ srvctl config database -d orclcdb
Database unique name: ORCLCDB
Database name: ORCLCDB
Oracle home: /u01/app/oracle/product/19.0.0/db_1
Oracle user: oracle
Spfile: +DATA/ORCLCDB/PARAMETERFILE/spfile.271.1055166363
Password file: +DATA/ORCLCDB/pwfile
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: DATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oper
Database instances: ORCLCDB1
Configured nodes: node1
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed

Our goal is to make SPFILE file name simplified and easy to remember by virtualizing its path.

Solution

The best solution is to make a symbolic link that points to the original file, but we have no ln command in ASMCMD. Luckily, we can use mkalias command in ASMCMD instead.

We first make an alias file for current SPFILE.

1. Make File Alias for Spfile

ASMCMD> cd +DATA/ORCLCDB/PARAMETERFILE
ASMCMD> ls -l
Type           Redund  Striped  Time             Sys  Name
PARAMETERFILE  UNPROT  COARSE   OCT 30 14:00:00  Y    spfile.271.1055166363
ASMCMD> cd ..
ASMCMD> mkalias PARAMETERFILE/spfile.271.1055166363 spfile
ASMCMD> ls -l spfile
Type           Redund  Striped  Time             Sys  Name
PARAMETERFILE  UNPROT  COARSE   OCT 30 14:00:00  N    spfile => +DATA/ORCLCDB/PARAMETERFILE/spfile.271.1055166363
ASMCMD> exit

3. Modify SFILE Location for Database

[oracle@node1 ~]$ srvctl modify database -d orclcdb -spfile +DATA/ORCLCDB/spfile

Let's check the result.

[oracle@node1 ~]$ srvctl config database -d orclcdb
Database unique name: ORCLCDB
Database name: ORCLCDB
Oracle home: /u01/app/oracle/product/19.0.0/db_1
Oracle user: oracle
Spfile: +DATA/ORCLCDB/spfile
Password file: +DATA/ORCLCDB/pwfile
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: DATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oper
Database instances: ORCLCDB1
Configured nodes: node1
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed

Let's restart the database to verify the new file.

[oracle@node1 ~]$ srvctl stop database -d orclcdb
[oracle@node1 ~]$ srvctl start database -d orclcdb
[oracle@node1 ~]$ sqlplus / as sysdba
...
SQL> show parameter spfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATA/ORCLCDB/spfile

It works.

By the way, if you want to remove the alias files, don't use rm, use rmalias command in ASMCMD to remove the links instead. Otherwise, you have a trouble.

In this post, we didn't move the actual SPFILE, we just make a link to redirect it to the actual location. To move the physical SPFILE to another place for a RAC database, we should use RMAN or PFILE, you may take a look.

Leave a Reply

Your email address will not be published.