In this section, we will modify two pfiles, one for the primary database, the other is for the standby database.
- Create primary pfile.
- Create pfile from current spfile on the primary database.
- Modify the primary pfile and add initialization parameters for data guard configuration.
- Create standby spfile.
- Make another copy of pfile for the standby database.
- Modify the standby pfile in a similar way, but "primdb" should be switched places with "standb" and vice versa.
- Copy the modified standby pfile to either node of the standby RAC.
[oracle@primary01 ~]$ sqlplus / as sysdba
...
SQL> create pfile='/tmp/init-prim.ora' from spfile='+data/compdb/spfileprimdb.ora';
File created.
SQL> exit;
...
Note: you must know the correct path of spfile, which is usually in a clustered destination. Otherwise, you will found that you create a pfile from a wrong spfile. You may check my post Why SPFILE Does Not Work in RAC for more information.
[oracle@primary01 ~]$ vi /tmp/init-prim.ora
...
# For Data Guard Configuration
LOG_ARCHIVE_CONFIG='DG_CONFIG=(primdb,standb)'
LOG_ARCHIVE_DEST_1=
'LOCATION="USE_DB_RECOVERY_FILE_DEST"
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=primdb'
LOG_ARCHIVE_DEST_2=
'SERVICE=standb ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=standb'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
LOG_ARCHIVE_MAX_PROCESSES=30
# For Standby Role Configuration
FAL_SERVER=standb1,standb2
DB_FILE_NAME_CONVERT='standb','primdb'
STANDBY_FILE_MANAGEMENT=AUTO
...
[oracle@primary01 ~]$ cp /tmp/init-prim.ora /tmp/init-stan.ora
[oracle@primary01 ~]$ vi /tmp/init-stan.ora
...
# For Data Guard Configuration
LOG_ARCHIVE_CONFIG='DG_CONFIG=(standb,primdb)'
LOG_ARCHIVE_DEST_1=
'LOCATION="USE_DB_RECOVERY_FILE_DEST"
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=standb'
LOG_ARCHIVE_DEST_2=
'SERVICE=primdb ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=primdb'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
LOG_ARCHIVE_MAX_PROCESSES=30
# For Standby Role Configuration
FAL_SERVER=primdb1,primdb2
DB_FILE_NAME_CONVERT='primdb','standb'
STANDBY_FILE_MANAGEMENT=AUTO
...
[oracle@primary01 ~]$ scp /tmp/init-stan.ora standby01:/tmp/init-stan.ora