fbpx

Copy Password File From Primary ASM to Standby ASM on Oracle 19c

To copy the password file from a primary database to a standby database it requires a few steps, especially if the password is located inside the ASM.

This article describes how to copy the password file for an Oracle RAC environment, but it can also be used for standalone databases.

1. Get the password file from primary database

First get the password file location in the ASM from the primary database.

srvctl config database -d <primary> | grep Password

On the Primary site as the grid user, copy the password file out of ASM to a file system based location, in this case /tmp

Primary Site:

[oracle@node1 dbs]$ su - grid
Password:

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

[grid@node1 ~]$ asmcmd


ASMCMD> pwcopy +DATA/DB191/PASSWORD/pwddb191.256.867607273 /tmp/orapwdb191
copying +DATA/DB191/PASSWORD/pwddb191.256.867607273 -> /tmp/orapwdb191
ASMCMD> exit

2. Copy the password file to one of the standby RAC nodes

You have to copy the password file from the primary server to one of the standby database servers.

Primary Site:

[oracle@node1 dbs]$ scp /tmp/orapwdb191 oracle@node1:/tmp/orapwdb1911
...
Are you sure you want to continue connecting (yes/no)? yes

oracle@node2's password:
orapwdb191                           100% 7680     7.5KB/s   00:00

3. Copy the password file from filesystem to ASM

On the standby node that now has a copy of the password file, copy the password file into ASM as grid user.

The ASM command pwcopy can be used to perform this task.

Make sure the file is placed in the diskgroup and sub-directory for the standby identified through its db_unique_name value. In this case +DATA and DB191STB.

Standby Site:

$ su - grid
Password:

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

[grid@node1~]$ asmcmd

ASMCMD> pwcopy /tmp/orapwdb1911 +DATA/DB191STB/orapwdb1911
copying /tmp/orapwdb1911 -> +DATA/DB191STB/orapwdb1911

ASMCMD> ls -l  +DATA/DB191STB/orapwdb1911
Type      Redund  Striped  Time             Sys  Name
PASSWORD  UNPROT  COARSE   FEB 26 11:00:00  N    orapwdb1911 => +DATA/ASM/PASSWORD/pwdasm.279.872680185

4. Update the clusterware with the password file

As the owner of the RDBMS software for the database, update the clusterware resource for the database and set the location of the password file to be used by the database using srvctl modify database command.

Standby Site:

$ su - oracle
Password:

[oracle@node1~]$ . oraenv
ORACLE_SID = [oracle] ? db1911
The Oracle base has been set to /u01/app/oracle

[oracle@node1~]$ srvctl modify database -d db191stb -pwfile +DATA/DB191STB/orapwdb1911

[oracle@node1~]$ srvctl config  database -d db191stb

Database unique name: db191stb
Database name:
Oracle home: /u01/app/oracle/product/19.0.0/dbhome_1
Oracle user: oracle
Spfile: /u01/app/oracle/product/19.0.0/dbhome_1/dbs/spfiledb1911.ora
Password file: +DATA/DB191STB/orapwdb1911
Domain: <domain>
Start options: mount
Stop options: immediate
Database role: PHYSICAL_STANDBY
Management policy: AUTOMATIC
Server pools:
Disk Groups: DATA,FRA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group:
Database instances: db1911,db1912
Configured nodes: node1, node2
Database is administrator managed

I hope this was helpful.

Leave a Reply

Your email address will not be published. Required fields are marked *