Standby Database Checklist: 1. Overview
Standby Database Checklist: 1. Overview
1. Overview
The following document describes the setup of an 11gR2 standby database environment with Data Guard Redo
Apply option and Grid Control. The basic setup consists of creating a standby database using RMAN active
duplication on separate servers. The standby database is then set up in "managed recovery" mode to automate the
process of keeping the standby in sync with the primary database. Both the primary and standby databases are
registered with Oracle Grid Control and the Data Guard configuration can be performed manually or from the Grid
Control console.
Note that the appropriate log_* initialization parameters need to be set in the pfile/spfile to manage the archive log
files that will now be created.
This prevents the use of the "nologging" feature, which would not be replicated in the redo logs, and therefore not
applied on the standby database.
remote_login_passwordfile='EXCLUSIVE'
The naming convention is SRL for Standby Redo Log, xx for group number, [a-z] for member number, and RDO
extension for redo log.
To avoid this on the primary database the db_unique_name should remain set to what the db_name parameter is set
to (this is the default). The standby database can be set to whatever is appropriate. An example naming scheme
could be:
The following examples create a symmetrical environment such that switching back and forth between primary and
standby database is transparent to the networking files.
SQLNET.AUTHENTICATION_SERVICES = (NTS)
#
# LISTENER.ORA Network Configuration File
#
LISTENER_ORADB =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ORADBVM1)(PORT = 1522))
)
)
)
SID_LIST_LISTENER_ORADB =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ORADB)
(ORACLE_HOME = D:\Oracle_Base\Oracle11g)
(SID_NAME = ORADB)
)
)
ADR_BASE_LISTENER_ORADB = D:\Oracle_Base\Oracle11g\log
ORADB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ORADBVM1)(PORT = 1522))
(CONNECT_DATA =
(SERVER=DEDICATED)
(SERVICE_NAME = ORADB)
)
)
LISTENER_ORADB =
(ADDRESS = ((PROTOCOL = TCP)(HOST = ORADBVM1)(PORT = 1522))
#
# Set fast recovery area
#
db_recovery_file_dest='e:\oracle11g\flash_recovery_area'
db_recovery_file_dest_size=100000M
#
# Set logging parameters – this should not need to be set. log_archive_dest_1 is
# implicitly set in 11gR2 (was log_archive_dest_10)
#
#log_archive_dest_1 = 'LOCATION=USE_DB_RECOVERY_FILE_DEST valid_for=(ONLINE_LOGFILE,ALL_ROLES)'
#log_archive_dest_state_1='ENABLE'
When using the fast recovery area, normally the log_archive_dest_n parameters should only be set for non-fast
recovery area locations. By default the log_archive_dest_1 location will be used for the fast recovery area (this was
log_archive_dest_10 in previous releases).
NOTE: It is important to be aware of the differences when using OMF naming and directories versus traditional user
named files and directories.
Because of the way the instance naming occurs the following additional directories should be pre-created.
ORADB_DG\ARCHIVELOG
ONLINELOG
• oradata Directories
ORADB\CONTROLFILE
ORADB_DG\DATAFILE
ONLINELOG
ORADB_DG\ARCHIVELOG
ONLINELOG
• oradata Directories
ORADB
SQLNET.AUTHENTICATION_SERVICES = (NTS)
#
# LISTENER.ORA Network Configuration File
#
LISTENER_ORADBVM2 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ORADBVM2)(PORT = 1522))
)
)
)
SID_LIST_LISTENER_ORADBVM2 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ORADB_DG)
ADR_BASE_LISTENER_ORADBVM2 = D:\Oracle_Base\Oracle11g\log
ORADB_DG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ORADBVM2)(PORT = 1522))
(CONNECT_DATA =
(SERVER=DEDICATED)
(SERVICE_NAME = ORADB_DG)
)
)
LISTENER_ORADB =
(ADDRESS = ((PROTOCOL = TCP)(HOST = ORADBVM2)(PORT = 1522))
cd D:\Oracle_Base\Oracle11g\database
Create a file called initORADB.ora and add the following line to it:
db_name = ORADB
set ORACLE_HOME=D:\Oracle_Base\Oracle11g
lsnrctl start listener_oradb
set ORACLE_SID=ORADB
sqlplus / as sysdba
SQL> startup nomount
SQL> exit
rman
RMAN> CONNECT target sys/UHave2Chooose@ORADB
RMAN> CONNECT AUXILIARY sys/UHave2Choose@ORADB_DG
RMAN> run {
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate auxiliary channel stby1 type disk;
allocate auxiliary channel stby2 type disk;
#
duplicate target database
for standby
from active database
spfile
set db_unique_name = 'ORADB_DG'
set fal_server = 'ORADB'
set log_archive_dest_2 = 'SERVICE=ORADB ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=ORADB COMPRESSION=ENABLE '
set log_archive_dest_state_2='DEFER'
set db_recovery_file_dest='E:\flash_recovery_area'
set memory_target='1G'
set local_listener='LISTENER_ORADB'
dorecover
nofilenamecheck;
}
System altered.
System altered.
4. Standby Management
4.1 Start the Standby Instance
The standby instance must be started and placed in standby mount mode. The database should never be "opened"
because this will invalidate the "standby" status. In addition, the database must be mounted in order to access the
controlfile to allow file name changes and subsequent recovery. The following commands are used:
1. Use SQL*Plus to connect to the standby database instance. For example, enter:
2. Start the Oracle instance at the standby database without mounting the
database. For example, enter:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;
The USING CURRENT LOGFILE clause is specified so that redo can be applied as soon as it has been received.
or
This will invoke standard cancel based recovery. Once all available archived log files have been applied then cancel
the recovery. At this point managed recovery can be resumed.
If you violate either of these two rules, then the standby database is down while the
primary database is open and archiving. Consequently, Oracle can create a gap
sequence. When you restart the standby database later, you must synchronize the
standby database manually with the primary database before you can initiate
managed recovery."
Once Data Guard is implemented this is typically not a problem since Data Guard will take care of re-
synchronization.
4.4 Troubleshooting
If the primary archive destination has stopped, possibly due to a full disk, fix the problem and issue:
archive log start
H:\>g:
G:\
G:\>cd G:\DBA\Grid_Control_Agent\windows_x64\agent
NOTE: The response file has been modified with Grid Control/OMS specific information! Copy the response
file to D:\oracle_base.
1. In the Databases screen select the primary database and click “Remove”.
2. Once complete, click the “Add” button. Choose the appropriate host and then manually add the database
using the db_unique_name.
6. DataGuard Setup
DataGuard can be set up manually (e.g. with Data Guard Broker commands) or it can be set up through Enterprise
Manager (i.e. OEM) Grid Control.
Note: We discovered that the Data Guard broker config files are not created until a configuration has been created.
This is different than what the documentation and My Oracle Support notes imply but Grid Control may have
already set the “dg_broker_start” parameter to TRUE.
System altered.
dg_broker_config_file2 string
/u01/app/oracle/product/11.2.0.2
/db_1/dbs/dr2ORADB.dat
$ dgmgrl
Configuration
Name: ORADB
Enabled: NO
Protection Mode: MaxPerformance
Databases:
ORADB - Primary database
Configuration
Name: ORADB
Enabled: NO
Protection Mode: MaxPerformance
Databases:
ORATST_DG1 - Primary database
ORATST_DG2 - Physical standby database
Configuration
DGMGRL>
7. References
Oracle® Database Backup and Recovery User's Guide, 11g Release 2 (11.2)