Data Guard
Data Guard
Data Guard
Architecture
Primary Database - A production database that is used to create standby databases. The archive
logs from the primary database are transfered and applied to standby databases. Each standby
can only be associated with a single primary database, but a single primary database can be
associated with multiple standby databases.
Standby Database - A replica of the primary database.
Log Transport Services - Control the automatic transfer of archive redo log files from the
primary database to one or more standby destinations.
Network Configuration - The primary database is connected to one or more standby databases
using Oracle Net.
Log Apply Services - Apply the archived redo logs to the standby database. The Managed
Recovery Process (MRP) actually does the work of maintaining and applying the archived redo
logs.
Role Management Services - Control the changing of database roles from primary to standby.
The services include switchover, switchback and failover.
Data Guard Broker - Controls the creation and monitoring of Data Guard. It comes with a GUI
and command line interface.
The services required on the primary database are:
Log Writer Process (LGWR) - Collects redo information and updates the online redo logs. It can
also create local archived redo logs and transmit online redo to standby databases.
Archiver Process (ARCn) - One or more archiver processes make copies of online redo logs
either locally or remotely for standby databases.
Fetch Archive Log (FAL) Server - Services requests for archive redo logs from FAL clients
running on multiple standby databases. Multiple FAL servers can be run on a primary database,
one for each FAL request. .
The services required on the standby database are:
Fetch Archive Log (FAL) Client - Pulls archived redo log files from the primary site. Initiates
transfer of archived redo logs when it detects a gap sequence.
Remote File Server (RFS) - Receives archived and/or standby redo logs from the primary
database.
Archiver (ARCn) Processes - Archives the standby redo logs applied by the managed recovery
process (MRP).
Managed Recovery Process (MRP) - Applies archive redo log information to the standby
database.
Data Guard can be configured to run with varying synchronization modes indicating the potential
for data loss:
No-Data-Loss mode : This simply means that the log transport services will not acknowledge
modifications to the primary database until they are available to the standby database. This
doesn't mean that the modifications have been applied to the standby database, merely that the
log information is available to the log apply services should failover occur. This mode is
implemented using standby redo logs on the standby server.
Minimal-Data-Loss mode : When the performance requirements of the primary database are the
top priority this mode provides the optimum balance of data protection and performance.
Setup No-Data-Divergence
To setup no-data-divergence, the most extreme level of data protection, then do the following:
CONTROL_FILES=primary.ctl
COMPATIBLE=9.0.1.0.0
LOG_ARCHIVE_START=true
LOG_ARCHIVE_DEST_1='LOCATION=C:\Oracle\Oradata\TSH1\Archive MANDATORY
REOPEN=30'
LOG_ARCHIVE_DEST_2='SERVICE=stby1 LGWR SYNC AFFIRM'
LOG_ARCHIVE_DEST_STATE_1=enable
LOG_ARCHIVE_DEST_STATE_2=enable
LOG_ARCHIVE_FORMAT=arc%t_%s.arc
REMOTE_ARCHIVE_ENABLE=trueThe LGWR SYNC AFFIRM keywords indicate that the
Logwriter should synchronously write updates to the online redo logs to this location and wait
for confirmation of the write before proceeding. The remote site will process and archive these
standby redo logs to keep the databases synchronized. This whole process can impact
performance greatly but provides maximum data security.
STANDBY_ARCHIVE_DEST=C:\Oracle\Oradata\TSH1\Archive
LOG_ARCHIVE_DEST_1='LOCATION=C:\Oracle\Oradata\TSH1\Archive'
LOG_ARCHIVE_TRACE=127
LOG_ARCHIVE_FORMAT=arc%t_%s.arc
STANDBY_FILE_MANAGEMENT=auto
REMOTE_ARCHIVE_ENABLE=trueAdd the following entries into the listener.ora file:
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = myHost)(PORT = 1512))
)
STANDBY_LISTENER = (ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(PORT=1512)(HOST=myHost))
)The file should resemble the following:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = myHost)(PORT = 1521))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = myHost)(PORT = 1512))
)
)
(DESCRIPTION =
(PROTOCOL_STACK =
(PRESENTATION = GIOP)
(SESSION = RAW)
)
(ADDRESS = (PROTOCOL = TCP)(HOST = myHost)(PORT = 2481))
)
)
STANDBY_LISTENER = (ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(PORT=1512)(HOST=myHost))
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC = (SID_NAME = PLSExtProc)(ORACLE_HOME = C:\Oracle\Ora901)
(PROGRAM = extproc))
(SID_DESC = (ORACLE_HOME = C:\Oracle\Ora901) (SID_NAME = TSH1)
)
)Reload the listener file using lsnrctl reload from the command prompt.
Add the following entry into the tnsnames.ora file:
stby1=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = myServerName)(PORT = 1512))
)
(CONNECT_DATA =
(SERVICE_NAME = stby1.world)
)
)
Create standby redo logs on the standby database to receive online redo information from
the Logwriter on the primary database. The minimum number of groups required is an exact
match, number and size, of the primary database, but performance may be increased by adding
more:
Copy all archive logs from the primary to the standby server. This is the only time you should
need to do this.
Database Switchover
A database can be in one of two mutually exclusive modes (primary or standby). These roles can
be altered at runtime without loss of data or resetting of redo logs. This process is known as a
Switchover and can be performed using the following statements:
Database Failover
Graceful Database Failover occurs when database failover causes a standby database to be
converted to a primary database:
Forced Database Failover changes one standby database to a primary database. Application data
may be lost neccessitating the reinstantiation of the primary and all standby databases.