Deploy Active Data Guard Far Sync Instances

Deploy Far Sync instances on OCI Compute VMs in each region to ensure zero data loss across regions.

  1. Create a Far Sync control file from the Primary database and copy it to the Far Sync hosts.
    SQL> alter database create far sync instance controlfile as '/home/oracle/controlfs.ctl';

    Copy the newly created control file to the Far Sync instance hosts.

    scp -p controlfs.ctl farsync-region1:/u01/app/oracle/oradata/fstor/controlfs/
    scp -p controlfs.ctl farsync-region2:/u01/app/oracle/oradata/fssyd/controlfs/
  2. Copy the password file of the Primary database to the Far Sync hosts using the Far Sync instance names.
    In this example, the Far Sync instance in the Primary region (Region 1) will be named FSTOR. Hence, the name of the password file will be orapwFSTOR.
    # check the location of the password file
    SQL> select file_name from v$passwordfile_info;
                        
    # as grid user, copy the file from ASM to the local filesystem
    asmcmd -p
    cp +DATAC2/DB_REGION1/PASSWORD/pwddb_region1.421.1185102507 /home/grid/orapw
                       
    # as root user, change the owner of the password file to oracle user
    cp /home/grid/orapw /home/oracle/
    chown oracle:oinstall /home/oracle/orapw
                        
    # copy the files to the Far Sync instance hosts using the new names "orapwFSTOR" and "orapwFSSYD"
    scp -p /home/oracle/orapw farsync-region1:/u01/app/oracle/product/19c/dbhome_1/dbs/orapwFSTOR
    scp -p /home/oracle/orapw farsync-region2:/u01/app/oracle/product/19c/dbhome_1/dbs/orapwFSSYD
  3. Create a parameter file for the Far Sync instance from the Primary database, copy it to the Far Sync instance hosts, and adjust the parameters to reflect your parameter values and directory paths for the Far Sync instance. Alternatively, you can start with a new parameter file on the Far Sync instance hosts (for example, in the Primary region).
    1. In the Primary region (FSTOR):
      # create a parameter file
      vi /u01/app/oracle/product/19c/dbhome_1/dbs/init_FSTOR.ora
      *.db_name='DBTOR'
      *.db_unique_name='FSTOR'
      *.compatible='19.0.0'
      *.control_files='/u01/app/oracle/oradata/fstor/controlfs/controlfs.ctl'
      *.diagnostic_dest='/u01/app/oracle/oradata/fstor/diag/'
      *.core_dump_dest='/u01/app/oracle/oradata/fstor/coredump/'
      *.audit_file_dest='/u01/app/oracle/oradata/fstor/audit/'
      *.audit_trail='DB'
      *.db_recovery_file_dest='/u01/app/oracle/oradata/fstor/fra/'
      *.db_recovery_file_dest_size=250g
      *.dg_broker_config_file1='/u01/app/oracle/oradata/fstor/dg_broker/fstor_01.dat'
      *.dg_broker_config_file2='/u01/app/oracle/oradata/fstor/dg_broker/fstor_02.dat'
      *.dg_broker_start=TRUE*.dispatchers='(PROTOCOL=TCP) (SERVICE=FSTORXDB)'
      *.standby_file_management='AUTO'
                                  
      # start the instance with the parameter file
      export ORACLE_SID=FSTOR
      sqlplus / as sysdba
      startup pfile='/u01/app/oracle/product/19c/dbhome_1/dbs/init_FSTOR.ora' nomount;
                                  
      # create an spfile
      create spfile='/u01/app/oracle/product/19c/dbhome_1/dbs/spfileFSTOR.ora' from pfile='/u01/app/oracle/product/19c/dbhome_1/dbs/init_FSTOR.ora';
                                  
      # restart the instance with the spfile
      shutdown immediate;
      startup mount;
      select name, db_unique_name, database_role, open_mode from v$database;
    2. In the Standby region (FSSYD):
      # create a parameter file
      vi /u01/app/oracle/product/19c/dbhome_1/dbs/init_FSSYD.ora
      *.db_name='DBTOR'
      *.db_unique_name='FSSYD'
      *.compatible='19.0.0'
      *.control_files='/u01/app/oracle/oradata/fssyd/controlfs/controlfs.ctl'
      *.diagnostic_dest='/u01/app/oracle/oradata/fssyd/diag/'
      *.core_dump_dest='/u01/app/oracle/oradata/fssyd/coredump/'
      *.audit_file_dest='/u01/app/oracle/oradata/fssyd/audit/'
      *.audit_trail='DB'
      *.db_recovery_file_dest='/u01/app/oracle/oradata/fssyd/fra/'
      *.db_recovery_file_dest_size=250g
      *.dg_broker_config_file1='/u01/app/oracle/oradata/fssyd/dg_broker/fssyd_01.dat'
      *.dg_broker_config_file2='/u01/app/oracle/oradata/fssyd/dg_broker/fssyd_02.dat'
      *.dg_broker_start=TRUE
      *.dispatchers='(PROTOCOL=TCP) (SERVICE=FSSYDXDB)'
      *.standby_file_management='AUTO'
                                  
      # start the instance with the parameter file
      export ORACLE_SID=FSSYD
      sqlplus / as sysdba
      startup pfile='/u01/app/oracle/product/19c/dbhome_1/dbs/init_FSSYD.ora' nomount;
                                  
      # create an spfile
      create spfile='/u01/app/oracle/product/19c/dbhome_1/dbs/spfileFSSYD.ora' from pfile='/u01/app/oracle/product/19c/dbhome_1/dbs/init_FSSYD.ora';
                                  
      # restart the instance with the spfile
      shutdown immediate;
      startup mount;
      select name, db_unique_name, database_role, open_mode from v$database;
  4. Create and start a database listener on each Far Sync host.
    1. In the Primary region:
      vi $ORACLE_HOME/network/admin/listener.ora
      LISTENER =
        (DESCRIPTION_LIST =
          (DESCRIPTION =
            (ADDRESS = (PROTOCOL = TCP)(HOST = farsync-region1.hubsubnetregion1.hubvcnregion1.oraclevcn.com)(PORT = 1521))
            (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
          )
        )
                                  
      lsnrctl start
      lsnrctl services
    2. In the Standby region:
      vi $ORACLE_HOME/network/admin/listener.ora
      LISTENER =
        (DESCRIPTION_LIST =
          (DESCRIPTION =
            (ADDRESS = (PROTOCOL = TCP)(HOST = farsync-region2.hubsubnetregion2.hubvcnregion2.oraclevcn.com)(PORT = 1521))
            (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
          )
        )
                                  
      lsnrctl start
      lsnrctl services
  5. Add primary and standby TNS entries on the Far Sync hosts.
    vi $ORACLE_HOME/network/admin/tnsnames.ora
                        
    DB_REGION1 =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = vmc1ca-4vzoi-scan.ocidbdelegated.ocivnoffsitedb.oraclevcn.com)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = db_region1.ocidbdelegated.ocivnoffsitedb.oraclevcn.com)
        )
      )
    
    DB_REGION2 =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = abvmc1auseh-glcfo-scan.ociabvnet5subn.ociabvirtualne.oraclevcn.com)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = db_region2.ociabvnet5subn.ociabvirtualne.oraclevcn.com)
        )
      )
  6. Add the Far Sync TNS entries on the primary and standby database hosts and test connectivity.

    Add the TNS connection strings of the Far Sync instances to the tnsname.ora file on the primary and standby database hosts (on all hosts of the Exadata VM cluster).

    vi $ORACLE_HOME/network/admin/dbtor/tnsnames.ora
    FSTOR =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = farsync-region1)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = FSTOR)
        )
      )
    
    FSSYD =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = farsync-region2)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = FSSYD)
        )
      )
    # Test the connectivity
    sqlplus SYS@FSTOR as sysdba
    show parameter instance_name
    
    sqlplus SYS@FSSYD as sysdba
    show parameter instance_name
    
    # If the connection fails, ensure port 1521 is open on Far Sync hosts
    sudo firewall-cmd --permanent --add-port=1521/tcp
    sudo firewall-cmd --reload
  7. Add and enable the Far Sync instances in the Active Data Guard broker configuration (from the Primary database).

    Use the Active Data Guard broker to add the Far Sync instance to the existing Active Data Guard configuration while connected to the Primary database.

    dgmgrl SYS as sysdba
    
    DGMGRL> ADD FAR_SYNC FSTOR AS CONNECT IDENTIFIER IS FSTOR;
    DGMGRL> ENABLE FAR_SYNC FSTOR;
    
    DGMGRL> ADD FAR_SYNC FSSYD AS CONNECT IDENTIFIER IS FSSYD;
    DGMGRL> ENABLE FAR_SYNC FSSYD;
  8. Configure RedoRoutes properties in the broker for primary databases and Far Sync instances.

    Use the Active Data Guard broker's RedoRoutes property to configure the Primary database to transport the redo to the local Far Sync instance in FastSync mode and the Far Sync instance to forward the redo to the remote standby database in ASYNC mode.

    DGMGRL> EDIT DATABASE 'db_region1' SET PROPERTY RedoRoutes = '( LOCAL : ( FSTOR FASTSYNC PRIORITY=1, db_region2 ASYNC PRIORITY=2 ))';
    DGMGRL> EDIT FAR_SYNC 'FSTOR' SET PROPERTY RedoRoutes = '( db_region1 : db_region2 ASYNC )';
    
    DGMGRL> EDIT DATABASE 'db_region2' SET PROPERTY RedoRoutes = '( LOCAL : ( FSSYD FASTSYNC PRIORITY=1, db_region1 ASYNC PRIORITY=2 ))';
    DGMGRL> EDIT FAR_SYNC 'FSSYD' SET PROPERTY RedoRoutes = '( db_region2 : db_region1 ASYNC )';
    The database log_archive_dest_n parameters for the primary, standby, and Far Sync instances are set accordingly.
  9. Change the configuration protection mode to Maximum Availability.
    DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY;
  10. Check the Active Data Guard configuration.
    DGMGRL> SHOW CONFIGURATION
    
    Configuration - dbtor_dgconf
    
    Protection Mode: MaxAvailability
    Members:
      db_region1 - Primary database
      fstor      - Far sync instance
      db_region2  - Physical standby database
    
    Members Not Receiving Redo:
      fssyd      - Far sync instance
    
    Fast-Start Failover:  Disabled
    
    Configuration Status:
      SUCCESS   (status updated 57 seconds ago)

    Note:

    Initially, the remote Far Sync instance might show Warning: ORA-16789: standby redo logs configured incorrectly until it receives redo data for the first time. For example, after a role switch or by temporarily updating redo routes.

    Check the configuration after the switchover.

    DGMGRL> SHOW CONFIGURATION
    
    Configuration - dbtor_dgconf
    
    Protection Mode: MaxAvailability
    Members:
      db_region2  - Primary database
      fssyd      - Far sync instance
      db_region1 - Physical standby database
    
    Members Not Receiving Redo:
      fstor      - Far sync instance
    
    Fast-Start Failover:  Disabled
    
    Configuration Status:
      SUCCESS   (status updated 54 seconds ago)