Complete the Configuration

Configure Oracle Data Guard, register the standby database, and synchronize the on-premises and standby database passwords.

Configure Oracle Data Guard Broker

Configure Oracle Data Guard by enabling the dg_broker_config_file parameter on the primary and standby databases. For Oracle Automatic Storage Management (Oracle ASM), place the broker configuration files on separate disk groups. For Oracle Real Application Clusters (Oracle RAC), the broker configuration files must be on shared storage.

  1. Check the dg_broker_start value for the on-premises database host. It should be set to false.
    SQL> show parameter dg_broker_start;
    The output will look similar to the following:
    NAME 			TYPE 			VALUE 
    ------------------------------------ ----------- ------------------------------ 
    dg_broker_start 	boolean 		FALSE 
  2. On the standby Oracle Database Exadata Cloud Service, check the Oracle Data Guard configuration files.
    SQL> show parameter dg_broker_config_file1;
    The following is example output:
    NAME                                 TYPE         VALUE
    ------------------------------------ ----------- ------------------------------
    dg_broker_config_file1               string       /u02/app/oracle/product/19.0.0.0/dbhome_5/dbs/dr1DB1_phx3g7.dat
    SQL> show parameter dg_broker_config_file2;
    The following is example output:
    NAME                                  TYPE         VALUE
    ------------------------------------ ----------- ------------------------------
    dg_broker_config_file2                string /u02/app/oracle/product/19.0.0.0/dbhome_5/dbs/dr2DB1_phx3g7.dat
  3. Display the datafiles, then change the location to where you want to store the files. For example, Oracle ASM, Oracle RAC , or devices.
    SQL> select name from v$datafile;
    NAME
    --------------------------------------------------------------------------------
    +DATAC1/DB1_PHX3G7/DATAFILE/system.348.1063638053
    +DATAC1/DB1_PHX3G7/DATAFILE/sysaux.349.1063638055
    +DATAC1/DB1_PHX3G7/DATAFILE/undotbs1.350.1063638057
    +DATAC1/DB1_PHX3G7/DATAFILE/undotbs2.351.1063638057
    +DATAC1/DB1_PHX3G7/DATAFILE/users.352.1063638059
    SQL> alter system set dg_broker_config_file1='+DATAC1/DB1_PHX3G7/dr1DB1_phx3g7.dat';
    SQL> alter system set dg_broker_config_file2='+RECOC1/DB1_PHX3G7/dr2DB1_phx3g7.dat';
  4. On the primary on-premises Oracle Exadata Database Machine, check the Oracle Data Guard configuration files.
    SQL> show parameter dg_broker_config_file1;
    The following is example output:
    NAME      TYPE      VALUE
    ------------------------------------ ----------- ------------------------------
    dg_broker_config_file1             string        /u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/dr1db1.dat.dat
    SQL> show parameter dg_broker_config_file2;
    The following is example output:
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    dg_broker_config_file2                string /u01/app/oracle/product/19.0.0.0/dbhome_1/dbs/dr2db1.dat
  5. Display the datafiles, then change the location to where you want to store the files.
    SQL> select name from v$datafile;
    The following is example output:
    NAME
    --------------------------------------------------------------------------------
    +DATAC1/DB1/DATAFILE/system.277.1063487795
    +DATAC1/DB1/DATAFILE/sysaux.270.1063487827
    +DATAC1/DB1/DATAFILE/undotbs1.259.1063487843
    +DATAC1/DB1/DATAFILE/undotbs2.275.1063487867
    +DATAC1/DB1/DATAFILE/users.269.1063487879
    Run the following commands to change the configuration file location:
    SQL> alter system set dg_broker_config_file1='+DATAC1/DB1/dr1db1.dat';
    SQL> alter system set dg_broker_config_file2='+RECOC1/DB1/dr2db1.dat';
    SQL> alter system set dg_broker_start=false;
    SQL> alter system set dg_broker_config_file1='+DATAC1/DB1/dr1db1.dat';
    SQL> alter system set dg_broker_config_file2='+RECOC1/DB1/dr2db1.dat';
  6. On the primary on-premises Oracle Exadata Database Machine, start the Oracle Data Guard Broker process.
    SQL> alter system set dg_broker_start=true;
    SQL> show parameter dg_broker_start 
    NAME 			TYPE 			VALUE 
    ------------------------------------ ----------- ------------------------------ 
    dg_broker_start 	boolean 		TRUE
    SQL> select pname from v$process where pname like 'DMON%';
    PNAME 
    ----- 
    DMON 
  7. Start the Oracle Data Guard Broker process on the standby database.
    SQL> alter system set dg_broker_start=true; 
    SQL> show parameter dg_broker_start
    NAME 			TYPE 			VALUE 
    ------------------------------------ ----------- ------------------------------ 
    dg_broker_start 	boolean 		TRUE
    SQL> select pname from v$process where pname like 'DMON%';
    PNAME 
    ----- 
    DMON 

Register the Standby Database

Use the Oracle Data Guard command-line interface (DGMGRL) to register, or add, the standby database profile to the broker configuration on the primary, on-premises host.

  1. Log into the primary host as sys.
    $ dgmgrl sys/sys password@net service name for primary database
  2. Create a configuration that uses the primary database name.
    DGMGRL> CREATE CONFIGURATION configuration_name AS PRIMARY DATABASE IS primary database name CONNECT IDENTIFIER IS primary database name;
    For example:
    CREATE CONFIGURATION OnPremExaDR AS PRIMARY DATABASE IS DB1 CONNECT IDENTIFIER IS DB1;
  3. Add the standby database.
    Ensure that your identifier is the same as the service name, including upper case and lower case.
    DGMGRL> ADD DATABASE standby unique database name AS CONNECT IDENTIFIER IS standby unique database name MAINTAINED AS PHYSICAL; 
    For example:
    ADD DATABASE DB1_PHX3G7 AS CONNECT IDENTIFIER IS DB1_phx3g7 MAINTAINED AS PHYSICAL;
    If you receive an ORA-16698 error message, then verify that your identifier is the same as the service name.

    Error: ORA-16698: member has a LOG_ARCHIVE_DEST_n parameter with SERVICE attribute set

  4. Change the log archive destination state.
    SQL> alter system set log_archive_dest_state_10='DEFER';
    SQL> alter system set log_archive_dest_10='';
  5. Verify the log archive destination.
    SQL> show parameter log_archive_dest;
    NAME                                TYPE           VALUE
    ------------------------------------ ----------- ------------------------------
    log_archive_dest                     string
    log_archive_dest_1                   string      LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=DB1_PHX3G7
    log_archive_dest_10                  string
    log_archive_dest_11                  string
    log_archive_dest_12                  string
    log_archive_dest_13                  string
    log_archive_dest_14                  string
    log_archive_dest_15                  string
    
    NAME                                 TYPE         VALUE
    ------------------------------------ ----------- ------------------------------
    log_archive_dest_16                  string
    log_archive_dest_17                  string
    log_archive_dest_18                  string
    log_archive_dest_19                  string
    log_archive_dest_2                   string     SERVICE=DB1 VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=DB1
    log_archive_dest_20                  string
    log_archive_dest_21                  string
    log_archive_dest_22                  string
    log_archive_dest_23                  string
  6. Enable the configuration.
    DGMGRL> enable configuration;
  7. Display the configuration.
    DGMGRL> show configuration;
    The output will look similar to the following:
    Configuration - onpremexadr
      Protection Mode: MaxPerformance
      Members:
      db1        - Primary database
        Warning: ORA-16809: multiple warnings detected for the member
        db1_phx3g7 - Physical standby database 
          Error: ORA-16532: Oracle Data Guard broker configuration does not 
    exist
    Fast-Start Failover:  Disabled
    Configuration Status:
    ERROR   (status updated 21 seconds ago)
  8. On the standby Oracle Database Exadata Cloud Service, log in to verify the configuration.
    [oracle@exacs82-vm3sv1 ~]$ dgmgrl
    DGMGRL> connect
    Username: sys
    Password:
    Connected to "DB1_phx3g7"
    Connected as SYSDBA.
    DGMGRL> show configuration;
    The output will be similar to the following:
    Configuration - onpremexadr
      Protection Mode: MaxPerformance
      Members:
      db1        - Primary database
        Warning: ORA-16809: multiple warnings detected for the member
        db1_phx3g7 - Physical standby database 
          Warning: ORA-16809: multiple warnings detected for the member
    Fast-Start Failover:  Disabled
    Configuration Status:
    WARNING   (status updated 43 seconds ago

Copy the Redo Log Files from On-Premises to OCI

Copy the redo log files and other database files from the on-premises database onto the Oracle Cloud Infrastructure (OCI) instance.

  1. View the on-premises database files.
    select name from v$datafile;
    The output will look similar to the following:
    NAME
    --------------------------------------------------------------------------------
    +DATAC1/DB1/DATAFILE/system.277.1063487795
    +DATAC1/DB1/DATAFILE/sysaux.270.1063487827
    +DATAC1/DB1/DATAFILE/undotbs1.259.1063487843
    +DATAC1/DB1/DATAFILE/undotbs2.275.1063487867
    +DATAC1/DB1/DATAFILE/users.269.1063487879
  2. View the size of each group for the on-premises data files.
    select bytes, group# from v$log;
    The output will look similar to the following:
    BYTES     GROUP#
    ---------- ----------
     209715200	    1
     209715200	    2
     209715200	    3
     209715200	    4
  3. View the redo logs for the on-premises data files.
    select member from v$logfile;
    The output will look similar to the following:
    MEMBER
    --------------------------------------------------------------------------------
    +DATAC1/DB1/ONLINELOG/group_2.272.1063449917
    +RECOC1/DB1/ONLINELOG/group_2.281.1063449917
    +DATAC1/DB1/ONLINELOG/group_1.273.1063449917
    +RECOC1/DB1/ONLINELOG/group_1.282.1063449919
    +DATAC1/DB1/ONLINELOG/group_3.268.1063450555
    +RECOC1/DB1/ONLINELOG/group_3.283.1063450557
    +DATAC1/DB1/ONLINELOG/group_4.261.1063450557
    +RECOC1/DB1/ONLINELOG/group_4.284.1063450557
  4. Add a standby log file group for each redo log.
    For example, if you have three redo log files, add three standby log file groups.
    SQL> 
    alter database add standby logfile group 5 ('+DATAC1','+RECOC1');
    alter database add standby logfile group 6 ('+DATAC1','+RECOC1');
    alter database add standby logfile group 7 ('+DATAC1','+RECOC1');
  5. View the members of the log file.
    SQL> select member from v$logfile;
    The output will look similar to the following:
    MEMBER
    --------------------------------------------------------------------------------
    +DATAC1/DB1/ONLINELOG/group_2.272.1063449917
    +RECOC1/DB1/ONLINELOG/group_2.281.1063449917
    +DATAC1/DB1/ONLINELOG/group_1.273.1063449917
    +RECOC1/DB1/ONLINELOG/group_1.282.1063449919
    +DATAC1/DB1/ONLINELOG/group_5.264.1063812687
    +DATAC1/DB1/ONLINELOG/group_3.268.1063450555
    +RECOC1/DB1/ONLINELOG/group_3.283.1063450557
    +DATAC1/DB1/ONLINELOG/group_4.261.1063450557
    +RECOC1/DB1/ONLINELOG/group_4.284.1063450557
    +RECOC1/DB1/ONLINELOG/group_5.422.1063812687
    +DATAC1/DB1/ONLINELOG/group_6.262.1063812785
    +RECOC1/DB1/ONLINELOG/group_6.445.1063812785
    +DATAC1/DB1/ONLINELOG/group_7.263.1063812807
    +RECOC1/DB1/ONLINELOG/group_7.446.1063812807
  6. View the group number and members of the log file.
    SQL> select group#,member from v$logfile;
    The output will look similar to the following:
    GROUP#                        MEMBER
    ------------      --------------------------------------------------
     2                +DATAC1/DB1/ONLINELOG/group_2.272.1063449917
     2                +RECOC1/DB1/ONLINELOG/group_2.281.1063449917
     1                +DATAC1/DB1/ONLINELOG/group_1.273.1063449917
     1                +RECOC1/DB1/ONLINELOG/group_1.282.1063449919
     5                +DATAC1/DB1/ONLINELOG/group_5.264.1063812687
     3                +DATAC1/DB1/ONLINELOG/group_3.268.1063450555
     3                +RECOC1/DB1/ONLINELOG/group_3.283.1063450557
     4                +DATAC1/DB1/ONLINELOG/group_4.261.1063450557
     4                +RECOC1/DB1/ONLINELOG/group_4.284.1063450557
     5                +RECOC1/DB1/ONLINELOG/group_5.422.1063812687
     6                +DATAC1/DB1/ONLINELOG/group_6.262.1063812785
     6                +RECOC1/DB1/ONLINELOG/group_6.445.1063812785
     7                +DATAC1/DB1/ONLINELOG/group_7.263.1063812807
     7                +RECOC1/DB1/ONLINELOG/group_7.446.1063812807
  7. View the configuration in Oracle Data Guard.
    DGMGRL> show configuration
    The output will look similar to the following:
    Configuration - onpremexadr
      Protection Mode: MaxPerformance
      Members:
      db1        - Primary database
        db1_phx3g7 - Physical standby database 
          Warning: ORA-16809: multiple warnings detected for the member
    Fast-Start Failover:  Disabled
    Configuration Status:
               WARNING   (status updated 8 seconds ago)
  8. On the standby Oracle Database Exadata Cloud Service, view the redo logs.
    select member from v$logfile;
    The output will look similar to the following:
    MEMBER
    ---------------------------------------------------
    /opt/oracle/oradata/ORCLCDB/redo03.log
    /opt/oracle/oradata/ORCLCDB/redo02.log
    /opt/oracle/oradata/ORCLCDB/redo01.log
  9. Log into an Oracle Data Guard command-line interface (DGMGRL) session on the standby Oracle Database Exadata Cloud Service database instance with the sys user name and password.
    [oracle@droci admin]$ dgmgrl 
    DGMGRL> connect
  10. View the configuration on the standby database in OCI.
    DGMGRL> show configuration;
    The output will look similar to the following:
    Configuration - OnPremDr
    Protection Mode: MaxPerformance
      Members:
      db1        - Primary database
        db1_phx3g7 - Physical standby database 
          Warning: ORA-16809: multiple warnings detected for the member
    Fast-Start Failover:  Disabled
    Configuration Status:
    WARNING   (status updated 38 seconds ago)
  11. Edit the standby database instance in OCI and set the state to apply-off. When the command succeeds, exit the command-line interface.
    DGMGRL> edit database DB1_phx3g7 set state=apply-off;
    DGMGRL> exit
  12. Log into the standby database instance in OCI as sysdba.
    [oracle@exacs82-vm3sv1 ~]$ sqlplus / as sysdba
  13. View the group number and members of the log file.
    SQL> select group#,member from v$logfile;
    The output will look similar to the following:
        
    GROUP#
    ----------
    MEMBER
    --------------------------------------------------------------------------------
     2
    +DATAC1/DB1_PHX3G7/ONLINELOG/group_2.354.1063638089
     3
    +DATAC1/DB1_PHX3G7/ONLINELOG/group_3.355.1063638089
     1
    +DATAC1/DB1_PHX3G7/ONLINELOG/group_1.353.1063638089
     4
    +DATAC1/DB1_PHX3G7/ONLINELOG/group_4.356.1063638089
  14. View the size of each group.
    select bytes, group# from v$log;
    The output will look similar to the following:
    BYTES     GROUP#
    ---------- ----------
     209715200	    1
     209715200	    2
     209715200	    3
     209715200	    4
  15. Add the standby log file groups to the database in OCI.
    [oracle@exacs82-vm3sv1 ~]$ sqlplus / as sysdba
    
    alter database add standby logfile group 5 ('+DATAC1','+RECOC1');
    alter database add standby logfile group 6 ('+DATAC1','+RECOC1');
    alter database add standby logfile group 7 ('+DATAC1','+RECOC1');
  16. View the group number and members of the log file.
    SQL> select group#,member from v$logfile;
    The output will look similar to the following:
        GROUP#
    ----------
    MEMBER
    --------------------------------------------------------------------------------
     2
    +DATAC1/DB1_PHX3G7/ONLINELOG/group_2.354.1063638089
     3
    +DATAC1/DB1_PHX3G7/ONLINELOG/group_3.355.1063638089
     1
    +DATAC1/DB1_PHX3G7/ONLINELOG/group_1.353.1063638089
     4
    +DATAC1/DB1_PHX3G7/ONLINELOG/group_4.356.1063638089
     5
    +DATAC1/DB1_PHX3G7/ONLINELOG/group_5.358.1063813749
     5
    +RECOC1/DB1_PHX3G7/ONLINELOG/group_5.256.1063813749
     6
    +DATAC1/DB1_PHX3G7/ONLINELOG/group_6.359.1063813761
     6
    +RECOC1/DB1_PHX3G7/ONLINELOG/group_6.262.1063813761
     7
    +DATAC1/DB1_PHX3G7/ONLINELOG/group_7.360.1063813773
     7
    +RECOC1/DB1_PHX3G7/ONLINELOG/group_7.300.1063813773
  17. On the standby OCI database instance, log into an Oracle Data Guard command-line interface (DGMGRL) session with the sys user name and password.
    [oracle@exacs82-vm3sv1 ~]$ dgmgrl
    DGMGRL> connect
    Username: sys
    Password:
    Connected to "DB1_phx3g7"
    Connected as SYSDBA.
  18. Edit the standby database instance in OCI and set the state to apply-on.
    DGMGRL> edit database db1_phx3g7 set state=apply-on;
  19. Edit the standby database instance in OCI and set the transport state to transport-on, then exit the command-line interface. When the command succeeds, exit DGMGRL.
    DGMGRL> edit database DB1 set state=transport-on;
    DGMGRL> exit
  20. View the standby log files in the standby database on OCI to verify standby.
    SQL> select * from v$logfile where type='STANDBY';
  21. View the redo log files in the standby database on OCI.
    SQL> select member from v$logfile where type != 'STANDBY';
    The output will look similar to the following:
    MEMBER
    --------------------------------------------------------------------------------
    +DATAC1/DB1_PHX3G7/ONLINELOG/group_2.354.1063638089
    +DATAC1/DB1_PHX3G7/ONLINELOG/group_3.355.1063638089
    +DATAC1/DB1_PHX3G7/ONLINELOG/group_1.353.1063638089
    +DATAC1/DB1_PHX3G7/ONLINELOG/group_4.356.1063638089
  22. Recover the managed standby database.
    SQL> recover managed standby database cancel;
    The output will look similar to the following:
    Media recovery complete
  23. View the files with the convert parameter.
    SQL> show parameter convert;
    The output will look similar to the following:
    NAME				     TYPE	 VALUE
    ------------------------------------ ----------- ------------------------------
    db_file_name_convert		    string       DB1, DB1_phx3g7
    log_file_name_convert		   string       DB1, DB1_phx3g7
    pdb_file_name_convert		   string
  24. View the database files.
    select name from v$datafile;
    The output will look similar to the following:
    NAME
    --------------------------------------------------------------------------------
    +DATAC1/DB1_PHX3G7/DATAFILE/system.348.1063638053
    +DATAC1/DB1_PHX3G7/DATAFILE/sysaux.349.1063638055
    +DATAC1/DB1_PHX3G7/DATAFILE/undotbs1.350.1063638057
    +DATAC1/DB1_PHX3G7/DATAFILE/undotbs2.351.1063638057
    +DATAC1/DB1_PHX3G7/DATAFILE/users.352.1063638059
  25. View the Oracle Data Guard archive details.
    SQL> SELECT ROLE, THREAD#, SEQUENCE#, ACTION FROM V$DATAGUARD_PROCESS;
    The output will look similar to the following:
    
    ROLE	    THREAD#     SEQUENCE#  ACTION
    ------------------------ ---------- ---------- ------------
    RFS ping			     1	     0 IDLE
    RFS ping			     2	    62 IDLE
    RFS async		           2	    62 RECEIVING
    broker instance worker            0	     0 IDLE
    broker worker			0	     0 IDLE
    archive redo			 0	     0 IDLE
    archive redo			 0	     0 IDLE
    archive redo			 0	     0 IDLE
    archive local			0	     0 IDLE
    redo transport timer		0	     0 IDLE
    gap manager			  0	     0 IDLE
    
    ROLE	    THREAD#     SEQUENCE#  ACTION
    ------------------------ ---------- ---------- ------------
    broker monitor		      0	     0 IDLE
    broker net worker		   0 	    0 IDLE
    redo transport monitor	     0	     0 IDLE
    log writer			   0	     0 IDLE
    RFS async	                  0	   187 RECEIVING
    16 rows selected.
  26. Disable the recovery of the managed standby database using the log file.
    SQL> recover managed standby database using current logfile disconnect;
    Media recovery complete.
  27. Display the files with the destination parameter and verify.
    SQL>show parameter dest;