8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
1/40
WHAT IS DATA GUARD
Oracles disaster recovery solution for Oracle data;
Feature of Oracle Database Enterprise Edition (EE);
Automates the creation and maintenance of one or moretransactionally consistent copies (standby) of the production
(or primary) database;
If the primary database becomes unavailable (disasters,
maintenance), a standby database can be activated and
assume the primary role.
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
2/40
SIMPLY PUT
Data Guard helps you protect your Data.
Takes your data and automatically puts it elsewhere
Makes it available for Failover in case of failure.
The other capabilities are.
Switchover for Maintenance
Reporting Off-loading Queries
Backups
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
3/40
ARCHITECTURE
Oracle
Net
FALPrimary
Database
Transactions
Physical/Logi
calStandby
Database
Backu
p /
Reports
LGWR
Online Redo
Logs
Archived Redo
Logs
ARCH
RFS
Standby
Redo
Logs
Archived RedoLogs
ARCH
MRP/ LSP
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
4/40
ARCHITECTURE CONTINUES
Primary Database:
A Data Guard configuration contains one production database, alsoreferred to as the primary database that functions in the primary role.
The primary database can be either a single-instance Oracle databaseor an Oracle Real Application Clusters database.
LGWR / ARCH Process
Collects Redo data from Primary and ship that to Standby .
Fetch Archive Log (FAL) Process
Provides client-server mechanism for shipping archived logs to theStandby.
For automatic gap resolution and resynchronization.
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
5/40
ARCHITECTURE CONTINUES
Standby Database:
A standby database is a transactionally consistent copy of the primary database.
Data Guard automatically maintains each standby database by transmitting redo data from the primary database and thenapplying the redo to the standby database.
Physical standby database
Physical Standby
Technology introduced in Oracle 7.2Marketed as Data Guard in Oracle 8.1.7 and above
Standby is identical copy of primary database
Redo changes
transported from primary to standby
applied on standby (Redo Apply)
Can switch operations to standby
Failover time deplaned (switchover / switchback)
Unplanned (failover)
pendent on various factors
Rate of redo generation / size of redo logs
Redo transport / apply configuration
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
6/40
ARCHITECTURE CONTINUES
Logical standby database
Introduced in Oracle 9.2
Subset of database objects
Redo copied from primary to standby
Changes converted into logical change records (LCR)
Logical change records applied on standby (SQL Apply)
Standby database can be opened for updates
Can modify propagated objects
Can create new indexes for propagated objects
May need larger system for logical standby
LCR apply can be less efficient than redo apply
Array updates on primary become single row updates on
standby
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
7/40
ARCHITECTURE CONTINUES
Processes Involved in Standby Recovery phase:
Remote File Server (RFS)
Receives Redo records from the Primary Database.
Managed Recovery Process (MRP)
Apply Redo information to the Physical Standby.
Logical Standby Process (LSP)
Apply SQL translated Redo information to the Logical standby.
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
8/40
MEDIARECOVERY PROCESS (MRP) -
REDOAPPLY
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
9/40
LOGICAL STANDBY PROCESS (LSP) -
SQL APPLY
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
10/40
SQL Apply uses a collection of parallel execution servers and
background processes.
Reader process Reads redo records from the archived logs;
Preparer process Covert the block changes into table changes,Logical Change Records (LCRs);
Builder Process Assembles completed transactions from theindividual LCRs.
Analyzer Process Examines the completed transactions,identifying dependencies between the different transactions.
Coordinator Process Assigns transactions to the Applierprocess, monitor dependencies between the transactions andauthorize the commit of changes to the logical standby database.
Applier Process Apply the changes into the database andcommit the transactions.
LSP Continues
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
11/40
PROTECTION LEVELS
The Protection Levels define how the Primary functions in thestandby configuration. They are:
Maximize Protection
Maximize Availability
Maximize Performance
Each one has a defined set of rules.
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
12/40
PROTECTION MODES
Protection Mode Failure Protection Redo Shipping
Maximum Protection
Zero Data Loss
Protects Against Primary
and Network FailureLGWR using SYNC
and SRL
Protects Against Primary
Failure
LGWR using SYNCMaximum Availability
Zero Data Loss
Best Effort Against Primary
Failure
ARCH or LGWR
using ASYNC
Maximum
Performance
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
13/40
MAXIMUM PROTECTION MODE
Protection Mode Failure Protection Redo Shipping
Protects Against Primary
and Network Failure
LGWR using SYNC
and SRL
Maximum Protection
Zero Data Loss
Zero Data Loss! ;
Highest Level of Protection;
Configuration: LGWR SYNC, SRLs;
Enforces protection of every transaction;
If last standby is unavailable, processing stops at primary;
Good for financial systems where no data loss is acceptable;
ALTER DATABASE SET STANDBY TO MAXIMIZEPROTECTION;
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
14/40
MAXIMUMAVAILABILITY MODE
Protection Mode Failure Protection Redo Shipping
Protects Against Primary
Failure
LGWR using SYNC
and SRL
Maximum Availability
Zero Data Loss
Zero Data Loss! as long as the network stays up!;
Configuration: LGWR SYNC, SRLs;
Enforces protection of every transaction;
If last standby is unavailable, processing continues at primary;
When the standby becomes available again, synchronizationwith the primary is automatic
ALTER DATABASE SET STANDBY TO MAXIMIZEAVAILABILITY;
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
15/40
MAXIMUM PERFORMANCE MODE
Protection Mode Failure Protection Redo Shipping
Best Effort Against
Primary Failure
ARCH or LGWR
using ASYNC
Maximum
Performance
Highest Level of Performance;
Configuration: LGWR ASYNC or ARCH;
Protects from failure of any single component;
Least impact on production system;
Useful for applications that can tolerate some data loss.
ALTER DATABASE SET STANDBY TO MAXIMIZEPERFORMANCE;
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
16/40
DATAGUARD SERVICESRedo Transport Services
Control the automated transfer of redo data from the production database to one ormore archival destinations
Log Apply Services
Redo data would be applied either from archived redo log files, or, if real-time applyis enabled, directly from the standby redo log files as they are being filled, withoutrequiring the redo data to be archived first at the standby database.
Role Transitions
Switchover
Role reversal between the primary database and one of its standby databases. Thisis typically done for planned maintenance of the primary system
During a switchover, the primary database transitions to a standby role, and the
standby database transitions to the primary role.
Failover
Occurs, when the primary database is unavailable.
Failover is performed only in the event of a catastrophic failure of the primarydatabase, and the failover results in a transition of a standby database to the primary.
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
17/40
HIGH LEVEL
Broader perspective, Data Guard comprises of two parts:
REDO APPLY (DR)
Maintains a physical, block for block copy of the
Production (also called Primary) database.
SQL APPLY (Reporting)
Maintains a logical, transaction for transaction copy of the
Production database.
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
18/40
DATAGUARD REDOAPPLY: BEST FOR DR
Data Guard Broker
PrimaryDatabase
Physical StandbyDatabase
Optional
Delay
Sync or AsyncRedo Shipping
Network
Redo Apply
DIGITALDAT A STORAGE
Backup
Physical Standby Database is a block-for-block copy of the primarydatabase
Uses the database recovery functionality to apply changes
Can be opened in read-only mode for reporting/queries
Can also perform backup, offloading production database
The best solution for DR
Sync or AsyncRedo Shipping Redo ApplyRedo Apply
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
19/40
DATAGUARD SQL APPLY
Optional
Delay
AdditionalIndexes &
MaterializedViews
Sync or AsyncRedo Shipping
Network
ContinuouslyOpen for Reports
Data Guard BrokerPrimaryDatabase Logical Standby
Database
Logical Standby Database is an open, independent, active database
Contains the same logical information (rows) as the production database
Physical organization and structure can be very different
Can host multiple schemas
Can be queried for reports while logs are being applied via SQL
Can create additional indexes and materialized views for better queryperformance
Not all Data Types supported (See the manual for a list)
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
20/40
REDO DATATRANSMISSION HOW?
Redo data could transferred from Primary to Standby by any
one of the following way:
Using Archiver Processes (ARCn) to Archive Redo Data.
Using the Log Writer Process (LGWR) to Archive Redo
Data.
By default, redo transport services use ARCn processes to
archive the online redo log files on the primary database.
ARCn archival processing supports only the maximum
performance level of data protection in Data Guardconfigurations.
LGWR process would be used to transmit redo data to standby
locations that operate in other data protection modes.
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
21/40
DATAGUARD
ARCH REDO TRANSMISSION
ARC0 ARC1
Online
Redo
Log
LGWR RFS
Standby
Redo
Log
ARCn
Archived
Redo
Logs
MRP
LSPStandby
Database
Primary
Database
LOG_ARCHIVE_DEST_1
Primary Database Standby Database
Archived
Redo
Logs
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
22/40
DATAGUARD
LGWR (ASYNC) REDO TRANSMISSION
Archived
Redo
Logs
ARCn
RFS
Standby
Redo
Log
ARCn
Archived
Redo
Logs
MRP
LSPStandby
Database
Primary
Database
LOG_ARCHIVE_DEST_1
Primary Database Standby Database
LNSn
LGWR
Online
Redo
Log
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
23/40
DATAGUARD
LGWR (SYNC) REDO TRANSMISSION
Archived
Redo
Logs
ARCn
Online
Redo
Log
RFS
Standby
Redo
Log
ARCn
Archived
Redo
Logs
MRP
LSPStandby
Database
Primary
Database
LOG_ARCHIVE_DEST_1
Primary Database Standby Database
LNSnLGWR
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
24/40
DATAGUARD ROLE TRANSITIONS
There are two types of role transition
Switchover
Planned failover to standby database
Original primary becomes new standby
Original standby becomes new primary
No data loss
Can switchback at any time
Failover
Unplanned failover to standby database
Original standby becomes new primary
Original primary may need to be rebuilt
Possible data loss
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
25/40
DATAGUARD SWITCHOVER
After SwitchoverBefore Switchover
Primary
Instance
Database
Primary
Database
Site1
Database
Physical
Standby
Instance
Standby
Database
Site2
Standby
Database
Physical
Standby
Instance
Database
Site1
Database
Primary
Instance
Primary
Database
Site2
Redo Redo
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
26/40
DATAGUARD FAILOVER
Database
Physical
StandbyInstance
Standby
Databas
Site2
After FailoverBefore Failover
Primary
Instance
Database
Primary
Database
Site1
Database
Physical
Standby
Instance
Standby
Database
Site2
Unavailable
Primary
Instance
Database
Site1
Database
Primary
Instance
Primary
Database
Site2
Redo Redo
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
27/40
REDOAPPLY OR SQL APPLY..?
Maintains a physical, block-for-
block copy of the primary.
Can be open for read-only
queries.
At role transition, offers the
assurance that the standby
database chosen to be the new
primary has not been changed
compared to the old primary.
Can be used for backups
Faster, since it bypasses the
SQL transformation layer.
Maintains a logical,
transaction-for-transaction
copy of the primary.
Allows creation of additionalobjects, modification of
objects.
Possible to skip apply on
certain objects.
Can be used as a goodreporting solution supports
real-time reporting in 10g.
Has data type restrictions.
SQLApplyRedo Apply
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
28/40
PHYSICAL STANDBY - CONFIGURATION
Step Up Overview:
Step 1 - Prepare the Primary for Standby
Step 2 - Copy the necessary files to standby system
Step 3 - Configure the Standby Parameters
Step 4 - Configure OracleNet
Step 5 - Startup the Standby Site
Step 6 - Begin Shipping and Applying Redo
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
29/40
CONFIGURATION
Attached the document which has Step-by-Stepconfiguration of Physical Standby Database.
Microsoft Office
Word Document
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
30/40
LOGICAL STANDBY - CONFIGURATION
Step Up Overview:
Step 1 - Prepare the Primary for Standby
Step 2 - Copy the necessary files to standby system
Step 3 - Configure the Standby Parameters
Step 4 - Configure OracleNet
Step 5 - Startup the Standby Site
Step 6 - Begin Shipping and Applying Redo
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
31/40
CONFIGURATION
Attached the document which has Step-by-Stepconfiguration of Logical Standby Database.
Microsoft Office
Word Document
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
32/40
ROLE TRANSITION - SWITCHOVER INVOLVES
PHYSICAL
STANDBY
DATABASE
Step Up Overview:
Step 1 Resolve the archived log Gaps.
Step 2 Verify the status of the databases to Switchover.
Step 3 Adjust the initialization parameters.
Step 4 Perform the switchover.
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
33/40
SWITCHOVER INVOLVES PHYSICAL
STANDBY DATABASE .
Attached the document which has Step-by-Step configurationto perform switchover with Physical Standby Database.
Microsoft Office
Word Document
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
34/40
ROLE TRANSITION - SWITCHOVER INVOLVES
LOGICAL STANDBY DATABASE
Step Up Overview:
Step 1 Resolve the archived log Gaps.
Step 2 Verify the status of the databases to Switchover.
Step 3 Adjust the initialization parameters.
Step 4 Perform the switchover.
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
35/40
SWITCHOVER INVOLVES LOGICAL
STANDBY DATABASE .
Attached the document which has Step-by-Step configurationto perform switchover with Logical Standby Database.
Microsoft Office
Word Document
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
36/40
ROLE TRANSITION - FAILOVER INVOLVES
PHYSICAL STANDBY DATABASE
Step Up Overview:
Step 1 Resolve the archived log Gaps.
Step 2 Adjust the initialization parameters.
Step 3 Initiate the Failover.
Step 4 Covert the Database Roles.
Step 5 Backup the new Primary Database.
Step 6
Optionally, Restore the failed Primary Database.
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
37/40
FAILOVER INVOLVES PHYSICAL
STANDBY DATABASE .
Attached the document which has Step-by-Step configurationto perform failover with Physical Standby Database.
Microsoft Office
Word Document
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
38/40
ROLE TRANSITION - FAILOVER INVOLVES
LOGICAL STANDBY DATABASE
Step Up Overview:
Step 1 Resolve the archived log Gaps.
Step 2 Adjust the initialization parameters.
Step 3 Initiate the Failover.
Step 4 Covert the Database Roles.
Step 5 Recover the other Standby Databases.
Step 6
Backup the new Primary Database.Step 7 Optionally, Restore the failed Primary Database.
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
39/40
FAILOVER INVOLVES LOGICAL STANDBY
DATABASE .
Attached the document which has Step-by-Step configurationto perform failover with Logical Standby Database.
Microsoft Office
Word Document
8/3/2019 Oracle Data Guard by Nagaraj Ramamurthy_97
40/40
SUMMARY.!!!
Data Guard provides an automated standby database whichcan essentially eliminate downtime of your production data.
Setup is easy and fairly straightforward.
Maintenance is minimal.
Switchovers and failovers can be done within a few minutes.
Reporting can be offloaded to the standby to ease theworkload on the primary.
And It's Free! (Included with Enterprise Edition)