Oracle Standby Database
Topic: How to build Oracle Standby Database in 11g or 12c version.
======================================================
*********Build Standby Database: 11g / 12c************
======================================================
1. Take RMAN HOT backup of Primary Database.
2. Transfer backup to Standby Server.
3. Restore the Standby database using the Primary database backup. Do Not Open Standby Database.
RMAN> DUPLICATE TARGET DATABASE FOR STANDBY BACKUP LOCATION ‘/DATA/BACKUP’ NOFILENAMECHECK DORECOVER;
or
RMAN> DUPLICATE DATABASE ‘PRIMARY’ FOR STANDBY BACKUP LOCATION ‘/DATA/BACKUP’ NOFILENAMECHECK;
or
RMAN> DUPLICATE DATABASE TO PRIMARY BACKUP LOCATION ‘/DATA/BACKUP’ NOFILENAMECHECK NOOPEN;
4. Copy TNS Entry of Primary DB to Standby and Standby DB to Prim locations.
5. Create new password file at Primary DB and scp to Standby location.
orapwd file=orapwPRIMARY password=oracle entries=12 ignorecase=y
6. Set parameters on both Primary and Standby Databses.
******ON PRIMARY*******
SQL> select name, open_mode from v$database;
NAME OPEN_MODE
——— ——————–
PRIMARY READ WRITE
SQL> alter system set log_archive_config=’DG_CONFIG=(PRIMARY,STANDBY)’ SCOPE=both ;
SQL> alter system set log_archive_dest_1=’LOCATION=/u01/archivelogs valid_for=(ALL_LOGFILES,ALL_ROLES) db_unique_name=PRIM’ ;
SQL> ALTER SYSTEM SET log_archive_dest_2=’SERVICE=STANDBY LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=STANDBY’ SCOPE=BOTH ;
SQL> alter system set fal_server=STANDBY SCOPE=both ;
SQL> alter system set fal_client=PRIMARY SCOPE=both ;
SQL> alter system set standby_file_management=AUTO scope=both ;
*******ON STANDBY********
SQL> select name, open_mode from v$database;
NAME OPEN_MODE
——— ——————–
PRIMARY MOUNTED
SQL> alter system set log_archive_config=’DG_CONFIG=(PRIMARY,STANDBY)’ SCOPE=both ;
SQL> alter system set fal_server=PRIMARY SCOPE=both ;
SQL> alter system set fal_client=STANDBY SCOPE=both ;
SQL> alter system set standby_archive_dest=’/u01/archivelogs’ scope=both;
SQL> alter system set standby_file_management=AUTO scope=both ;
7. Start MRP process at Standby database.
SQL> alter database recover managed standby database disconnect from session;
8. Enable dest_state_2 parameter at Primary Database.
SQL> alter system set log_archive_dest_state_2=ENABLE ;
9. Switch logfile at Primary Database.
SQL> alter system switch logfile;
10. Check Standby Database Gap.