Time for action – initial setup of Data Guard broker

We will now see the initial setup of the Data Guard broker in an existing Data Guard configuration.

  1. Ensure that both the primary and standby databases are up and running as shown in the following query:
    SQL> select db_unique_name,open_mode,database_role from v$database;
    DB_UNIQUE_NA OPEN_MODE            DATABASE_ROLE
    ------------ -------------------- ----------------
    turkey_un    READ WRITE           PRIMARY
    
    SQL>  select db_unique_name,open_mode,database_role from v$database;
    DB_UNIQUE_NA OPEN_MODE            DATABASE_ROLE
    ------------ -------------------- ----------------
    india_un     READ ONLY WITH APPLY PHYSICAL STANDBY
  2. Ensure that both the primary and standby databases are using server parameter files, so that the broker can form a healthy relationship between the broker properties and parameter values as follows:
    SQL> show parameter spfile
    NAME        TYPE        VALUE
    ----------- ----------- ------------------------------
    spfile      string      /u01/home/oracle/product/11.2.0/
                            db_1/dbs/spfileTURKEY.ora
  3. This step is optional. Set the configuration file location parameters on both the primary and standby databases. The default location of the broker configuration file in Windows is $ORACLE_HOME/dbs in Unix and %ORACLE_HOME%database. If you want to keep them in a non-default location, change the parameters as shown. If you don't set these parameters, the files will automatically be created under the default locations in the following steps. The following commands are used to change the parameters:
    ALTER SYSTEM SET dg_broker_config_file1 = 'u01apporacleroker_turkey01.dat' scope=both sid='*'; 
    ALTER SYSTEM SET dg_broker_config_file2 = 'u01apporacleroker_turkey02.dat ' scope=both sid='*'; 
    

    Or in an ASM filesystem, use the following command:

    ALTER SYSTEM SET dg_broker_config_file1 = '+DATA_AREA/turkey/broker_turkey01.dat' scope=both sid='*'; 
    ALTER SYSTEM SET dg_broker_config_file2 = '+DATA_AREA/turkey/broker_turkey02.dat' scope=both sid='*';
    

    Tip

    In RAC databases, set the broker configuration file location to a shared location and use the same value on all the instances.

  4. Start the DMON process on both the primary and standby databases by setting the DG_BROKER_START parameter as follows:
    SQL> alter system set dg_broker_start=TRUE scope=both;
    System altered.
  5. For UNIX systems, you can now check the existence of the DMON process using the ps command as follows:
    $ps -ef|grep dmon
    oracle   27335     1  0 02:39 ?        00:00:00 ora_dmon_TURKEY
    
  6. In the alert logfile, you will see the following:
    Thu Aug 30 02:39:11 2012
    DMON started with pid=35, OS id=27335
    Thu Aug 30 02:39:11 2012
    ALTER SYSTEM SET dg_broker_start=TRUE SCOPE=BOTH;
    Starting Data Guard Broker (DMON)
    
  7. If you monitor the DMON logfile, you'll see the error ORA-27037/ORA-16572 as shown in the following command line. This is expected behavior. These errors will be freed after creating the configuration using the broker utility DGMGRL:
    2012-08-30 02:39:14.332   DMON: cannot open configuration file "/u01/home/oracle/product/11.2.0/db_1/dbs/dr1turkey_un.dat", retrying
    2012-08-30 02:39:15.341   DMON: cannot open configuration file "/u01/home/oracle/product/11.2.0/db_1/dbs/dr1turkey_un.dat"
    2012-08-30 02:39:15.341   ORA-27037: unable to obtain file status
    2012-08-30 02:39:15.341   inux-x86_64 Error: 2: No such file or directory
    2012-08-30 02:39:15.342   Additional information: 3
    2012-08-30 02:39:15.342   DMON: Error opening "/u01/home/oracle/product/11.2.0/db_1/dbs/dr1turkey_un.dat", error = ORA-16572
    
  8. The configuration files will be created under the specified location or in the default directory automatically. The Data Guard broker will maintain two copies of its configuration files as follows:
    SQL> show parameter DG_BROKER_CONFIG_FILE
    NAME                    TYPE    VALUE
    ----------------------- ------- -----------------------------
    dg_broker_config_file1  string  /u01/home/oracle/product/11.2.0/  
                                    db_1/dbs/dr1turkey_un.dat
    dg_broker_config_file2  string  /u01/home/oracle/product/11.2.0/
                                    db_1/dbs/dr2turkey_un.dat
  9. Connect DGMGRL on the primary system and create the configuration as follows:
    [oracle@oracle-primary ~]$ dgmgrl
    DGMGRL for Linux: Version 11.2.0.1.0 - 64bit Production
    Copyright (c) 2000, 2009, Oracle. All rights reserved.
    Welcome to DGMGRL, type "help" for information.
    DGMGRL> connect sys/free2go
    Connected.
    
  10. You will need to specify a configuration name and the unique name of the primary database. The configuration name can be anything, but the name of the primary database must be DB_UNIQUE_NAME as shown in the following query:
    SQL> show parameter db_unique_name
    NAME              TYPE        VALUE
    ----------------- ----------- ------------------------------
    db_unique_name    string      turkey_un
    
    DGMGRL> CREATE CONFIGURATION 'PACKT' AS PRIMARY DATABASE IS 'turkey_un' CONNECT IDENTIFIER IS TURKEY;
    Configuration "PACKT" created with primary database "turkey_un"

    In the previous command, TURKEY_UN refers to DB_UNIQUE_NAME and TURKEY refers to Oracle Net Services name. The primary database will be added to the configuration and the metadata will be updated in the broker configuration file.

  11. Add a standby database to the Data Guard broker configuration as follows:
    SQL> show parameter db_unique_name
    NAME              TYPE        VALUE
    ----------------- ----------- ------------------------------
    db_unique_name    string      india_un
    
    DGMGRL> ADD DATABASE 'INDIA_UN' AS CONNECT IDENTIFIER IS 'INDIA';
    Database "INDIA_UN" added
  12. Enable the Data Guard broker configuration. After adding the standby database to the broker, the configuration will be disabled by default, as follows:
    DGMGRL> show configuration;
    Configuration - PACKT
      Protection Mode: MaxPerformance
      Databases:
        turkey_un - Primary database
        INDIA_UN  - Physical standby database
    Fast-Start Failover: DISABLED
    Configuration Status:
    DISABLED
    
    DGMGRL> enable configuration;
    Enabled.
    
    DGMGRL> show configuration;
    Configuration - PACKT
      Protection Mode: MaxPerformance
      Databases:
        turkey_un - Primary database
        INDIA_UN  - Physical standby database
    Fast-Start Failover: DISABLED
    Configuration Status:
    SUCCESS
    

What just happened?

We have seen the configuration of the Data Guard broker and how to add existing databases to the broker configuration.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.170.223