Configuring the Oracle ADG Planned Migration Broker

Prerequisites

The Oracle ADG has been set up.

Context

When the Oracle ADG needs to perform planned migration, you need to configure the Oracle built-in components in advance. Data Guard Broker is the name of an Oracle standby database solution for disaster recovery and high availability. This section gives an example of setting up and managing Data Guard using Data Guard Broker.

Procedure

  1. Configure logs.

    1. Run the following command to check whether the primary database is in archive log mode.
      SELECT log_mode FROM v$database;

      If the noarchivelog mode is used, run the following command to switch to the archive log mode.

      SHUTDOWN IMMEDIATE;
      STARTUP MOUNT;
      ALTER DATABASE ARCHIVELOG;
      ALTER DATABASE OPEN;
    2. Run the following command to enable forcible logging.
      ALTER DATABASE FORCE LOGGING;. 
      ALTER SYSTEM SWITCH LOGFILE;
    3. Create a standby REDO log.

      When creating a standby REDO log file, ensure that the size of the log file is at least the same as that of the original REDO log file.

      1. Run the select * from V$LOG; command to query the original log information.
      2. Run the following command to query the existing values of the current GROUP:

        select group#,member from v$logfile order by group#;

        The following figure shows the query result:

        Figure 1 Queries the existing group

        You need to create standby log files on the active/standby based on the number of REDO log files, and the start value of the group increases from the existing value. Take Figure 1 as an example, when only Thread 1 exists and the maximum value of GROUP in the figure is 2, the start value of GROUP must be greater than 2.

      3. Take Figure 1 as an example, if only Thread 1 exists, run the following command on the primary end to create REDO standby logs.
        ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 3 ('+REDO/hwdb/standby_redo01.log') SIZE 1024M;
        ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 4 ('+REDO/hwdb/standby_redo02.log') SIZE 1024M;
        ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 5 ('+REDO/hwdb/standby_redo03.log') SIZE 1024M;
      4. Take Figure 1 as an example, if only Thread 1 exists, Run the following command on the secondary end to create REDO standby logs.
        ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 3 ('+REDO/hwdbdg/standby_redo01.log') SIZE 1024M;
        ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 4 ('+REDO/hwdbdg/standby_redo02.log') SIZE 1024M;
        ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 5 ('+REDO/hwdbdg/standby_redo03.log') SIZE 1024M;

  2. Configure the TNS.

    Assume that the instance name of the secondary Oracle ADG database is hwdbdg.
    1. Add the following configuration items to the tnsnames.ora file.
      HWDBDG =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = TCP)(HOST = node2)(PORT = 1521))
          (CONNECT_DATA =
            (SERVER = DEDICATED)
            (SERVICE_NAME = hwdbdg)
          )
    2. Restart the listener on the active and standby servers.
      lsnrctl stop
      lsnrctl start

  3. Enable Broker.

    1. Run the following command on the active and standby ends to enable the Broker plug-in of the Oracle database.
      ALTER SYSTEM SET dg_broker_start=true;
    2. Run the following command on the active end to enter the Broker configuration page.
      su - oracle ; dgmgrl sys/passwd@hwdb

      Assume that hwdb is db_unique_name of the ADG primary end and hwdbdg is the db_unique_name of the ADG secondary end.

    3. Run the following command to configure the primary end.
      CREATE CONFIGURATION my_config AS PRIMARY DATABASE IS hwdb CONNECT IDENTIFIER IS hwdb;
    4. Run the following command to configure the secondary end.
      ADD DATABASE hwdbdg AS CONNECT IDENTIFIER IS hwdbdg MAINTAINED AS PHYSICAL;
    5. In the RAC cluster scenario, you need to specify the DG_BROKER_CONFIG configuration file.

      Run the following command on the primary server:

      ALTER SYSTEM SET DG_BROKER_START=FALSE; 
      ALTER SYSTEM SET DG_BROKER_CONFIG_FILE1 = '+REDO/{primary_db_unique_name}/DR1.DAT' SCOPE=BOTH; 
      ALTER SYSTEM SET DG_BROKER_CONFIG_FILE2 = '+REDO/{primary_db_unique_name}/DR2.DAT' SCOPE=BOTH; 
      ALTER SYSTEM SET DG_BROKER_START=TRUE;  

      Run the following command on the standby server:

      ALTER SYSTEM SET DG_BROKER_START=FALSE; 
      ALTER SYSTEM SET DG_BROKER_CONFIG_FILE1 = '+REDO/{standby_db_unique_name}/DR1.DAT' SCOPE=BOTH;
      ALTER SYSTEM SET DG_BROKER_CONFIG_FILE2 = '+REDO/{standby_db_unique_name}/DR2.DAT' SCOPE=BOTH; 
      ALTER SYSTEM SET DG_BROKER_START=TRUE;
    6. Run the following command to enable the Broker configuration.
      ENABLE CONFIGURATION;
    7. Run the following command to check the database configuration and status.
       SHOW CONFIGURATION;

      If SUCCESS is displayed, the configuration is successful and you can perform the Oracle ADG planned migration. Otherwise, the migration fails.


Copyright © Huawei Technologies Co., Ltd.