Skip to content

Building a Physical Standby Database (03/14) - Prepare pfile for both primary and standby database

  • by
Building a Physical Standby Database (02/14) - Prepare configuration files on both sides
Now, we are close to the core of a database. The pfile contains all the initialization parameters and make Oracle software to allocation resources and features on a database.

In this section, we will modify two pfiles, one for the primary database, the other is for the standby database.
  1. Create primary pfile.
    1. Create pfile from current spfile on the primary database.
    2. [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.
    3. Modify the primary pfile and add initialization parameters for data guard configuration.
    4. [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
      ...

  2. Create standby spfile.
    1. Make another copy of pfile for the standby database.
    2. [oracle@primary01 ~]$ cp /tmp/init-prim.ora /tmp/init-stan.ora
    3. Modify the standby pfile in a similar way, but "primdb" should be switched places with "standb" and vice versa.
    4. [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
      ...

    5. Copy the modified standby pfile to either node of the standby RAC.
    6. [oracle@primary01 ~]$ scp /tmp/init-stan.ora standby01:/tmp/init-stan.ora
Building a Physical Standby Database (04/14) - Enable force logging and archivelog on primary database

Leave a Reply

Your email address will not be published.