We will now see the initial setup of the Data Guard broker in an existing Data Guard configuration.
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
SQL> show parameter spfile NAME TYPE VALUE ----------- ----------- ------------------------------ spfile string /u01/home/oracle/product/11.2.0/ db_1/dbs/spfileTURKEY.ora
$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='*';
DG_BROKER_START
parameter as follows:SQL> alter system set dg_broker_start=TRUE scope=both; System altered.
ps
command as follows:$ps -ef|grep dmon oracle 27335 1 0 02:39 ? 00:00:00 ora_dmon_TURKEY
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)
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
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
[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.
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.
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
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