Follow the following steps to configure data guard with broker configuration
Assumption: - Let’s suppose we have two machine machine1 & machine2 with the hostname machine1.oracle.com & machine2.oracle.com respectively. For the beginning machine1 will be considered as primary machine and machine2 will be considered as standby machine.
On machine1 we have a primary database 'dg01' and we will configure a physical standby database dg02 on machine2.
Configuration on primary site:-
Step 1) Configure the database in archive log mode and enable the force logging.
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE FORCE LOGGING;
ALTER DATABASE OPEN;
Step 2) Configure standby redo log files to enable fast failover and real time apply. (Assume we have three redo log group)
ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 ‘/u01/app/oracle/oradata/dg01/sredo04.log’ size 50m;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 ‘/u01/app/oracle/oradata/dg01/sredo05.log’ size 50m;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 ‘/u01/app/oracle/oradata/dg01/sredo06.log’ size 50m;
ALTER DATABASE ADD STANDBY LOGFILE GROUP 7 ‘/u01/app/oracle/oradata/dg01/sredo07.log’ size 50m;
Note: - Number of standby redo log group must be more than number of redo log group and size of the standby logfile must be same as the size of redo log file.
Steps 3) CREATE PFILE FROM SPFILE.
Now configure following parameters for primary database:-
LOG_ARCGIVE_CONFIG='DG_CONFIG=(dg01,dg02)'
DB_UNIQUE_NAME=dg01
SERVICE_NAMES=dg01
DB_FILE_NAME_CONVERT=’/u01/app/oracle/oradata/dg02’,’/u01/app/oracle/oradata/dg01’
LOG_FILE_NAME_CONVERT=’/u01/app/oracle/oradata/dg02’,’/u01/app/oracle/oradata/dg01’
LOG_ARCHIVE_DEST_1=’location=/u01/app/oracle/oradata/dg01/archive VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=DG01’
LOG_ARCHIVE_DEST_2=’service=dg02 VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLES) DB_UNIQUE_NAME=DG02’
LOG_ARCHIVE_DEST_STATE_1=enable
LOG_ARCHIVE_DEST_STATE_2=enable
STANDBY_FILE_MANAGEMENT=auto
FAL_CLIENT=dg01
FAL_SERVER=dg02
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
Step 4) Take the entire database backup on pre configured staging directory.
mkdir /home/oracle/rman (Staging directory for rman backup)
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN> BACKUP FORMAT ‘/home/oracle/rman/%U’ DATABASE;
RMAN> BACKUP FORMAT ‘/home/oracle/rman/%U’ CURRENT CONTROLFILE FOR STANDBY;
RMAN> SQL “ALTER SYSTEM ARCHIVE LOG CURRENT”;
Step 5) Copy the following items from machine1 to machine2.
PASSWORD FILE
PARAMETER FILE
RMAN BACKUP TAKEN ABOVE
Note: - RMAN backup must be copy at the same directory on machine2 i.e. /home/oracle/rman.
Step 6) Configure net service for dg01 (primary database) as well as for dg02 (standby database).
DG01 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = machine1.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dg01)
(INSTANCE_NAME = dg01)
)
)
DG02 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = machine2.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dg02)
(INSTANCE_NAME = dg02)
)
)
Configuration on standby site:-
Step 7) Rename the password file and parameter file to initdg02.ora and orapwdg02 respectively. Now do the following parameter changes for standby database.
LOG_ARCGIVE_CONFIG='DG_CONFIG=(dg01,dg02)'DB_UNIQUE_NAME=dg02
SERVICE_NAMES=dg02
DB_FILE_NAME_CONVERT=’/u01/app/oracle/oradata/dg01’,’/u01/app/oracle/oradata/dg02’
LOG_FILE_NAME_CONVERT=’/u01/app/oracle/oradata/dg01’,’/u01/app/oracle/oradata/dg02’
LOG_ARCHIVE_DEST_1=’location=/u01/app/oracle/oradata/dg01/archive VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=DG02’
LOG_ARCHIVE_DEST_2=’service=dg01 VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLES) DB_UNIQUE_NAME=DG01’
LOG_ARCHIVE_DEST_STATE_1=enable
LOG_ARCHIVE_DEST_STATE_2=enable
STANDBY_FILE_MANAGEMENT=auto
FAL_CLIENT=dg02
FAL_SERVER=dg01
LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
Step 8) Create the required directory for standby database
cd /u01/app/oracle/admin
mkdir dg02
cd dg02
mkdir bdump udump adump cdump create pfile scripts
mkdir -p /u01/app/oracle/oradata/dg02/archive
Step 9) Configure net service for dg01 (primary) as well as dg02 (standby) database.
DG01 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = machine1.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dg01)
(INSTANCE_NAME = dg01)
)
)
DG02 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = machine2.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dg02)
(INSTANCE_NAME = dg02)
)
)
Step 10) Start dg02 at nomount stage.
export ORACLE_SID=dg02
CREATE SPFILE FROM PFILE;
STARTUP NOMOUNT
EXIT
Step 11) Now using RMAN duplicate command create standby database.
RMAN TARGET SYS/ORACLE@DG01
RMAN> CONNECT AUXILIARY SYS/ORACLE@DG02
RMAN> DUPLICATE TARGET DATABASE FOR STANDBY DORECOVER;
Note: execute above commands on machine1.
Above are the simple steps to configure physical standby database for your primary database.
As you know about data guard broker which makes data guard management ease and centralized. Following steps will tel you how to configure data guard broker using command line utility DGMGRL.
Step 1) Register a service db_name.db_domain_DGMGRL statically with the listener for primary as well as for standby database on primary as well as standby server.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dg01_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/oracle/product/10.2.0/db_1)
(SID_NAME = dg01)
)
(SID_DESC =
(GLOBAL_DBNAME = dg02_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/oracle/product/10.2.0/asm)
(SID_NAME = dg02)
)
)
Note:- Reload the listener after modifying the setting. (LSNRCTL RELOAD)
Step 2) Configure a parameter DG_BROKER_START=TRUE on primary as well as on standby side.
ALTER SYSTEM SET DG_BROKER_START=TRUE SCOPE=BOTH;
Step 3) Invoke DGMGRL and create the configuration
$ dgmgrl
DGMGRL> connect sys/oracle@dg01
DGMGRL> CREATE CONFIGURATION DGCONFIG1 AS PRIMARY DATABASE IS DG01 CONNECT IDENTIFIER IS 'DG01';
DGMGRL> ADD DATABASE DG02 AS CONNECT IDENTIFIER IS 'DG02' MAINTAINED AS PHYSICAL;
Step 4) Enable the configuration and check their status
DGMGRL> SHOW CONFIGURATION
DGMGRL> ENABLE CONFIGURATION
DGMGRL> SHOW CONFIGURATION
I JUST HOPE YOU WILL FIND SOME VALUABLE INFORMATION WHICH MAY ENHANCE YOUR KNOWLEDGE.
WISH YOU ALL THE BEST...