1
<Insert Picture Here>
Oracle Database 11g – Data Guard
Sanjeev Joglekar
Solution Support Center (SSC)
Agenda
• Overview <Insert Picture Here>
• Oracle 11g New Features
3
Agenda
• Overview <Insert Picture Here>
• Oracle 11g New Features
4
What is Data Guard?
• Data Availability & Data Protection solution for Oracle
• Automates creation and maintenance of one or more
synchronized copies (standby) of the production (or
primary) database
• If the primary database becomes unavailable, a
standby database can easily assume the primary role
• Standby databases also used for:
• Queries, reporting, or backups while in standby role
• Active Data Guard license required
• Testing
• Using standard feature Snapshot Standby Database
5
Oracle Data Guard Architecture
Dallas Physical Open R/O
Standby
Sync or Async
Redo Shipping
Production Redo
Database Apply
Network
Backup
Broker
DIGITAL DATA STORAGE
DIGITAL DATA STORAGE
Logical Open R/W
Transform Standby
Chicago Redo to SQL
SQL
Apply
Boston
6
Data Guard Process Architecture
Redo Transport & Apply
Physical/Logical
Transactions Oracle Net Standby Database
MRP - physical
LGWR LNS RFS LSP - logical
sync
Standb
async y Transform Redo
Online Redo
Primary arch to SQL for
Redo Logs Logs
Logical Standby
Database
ARCH Queries,
Reports,
ARCH Testing,
Backups
Archived
Archived Redo Logs
Redo Logs
7
Data Guard Automatic Gap Resolution
Example - Maximum Availability (SYNC)
Physical/Logical
Transactions Oracle Net Standby Database
MRP - physical
LGWR LNS RFS LSP - logical
sync
Standb
y Transform Redo
Online Redo
Primary to SQL for
Redo Logs Logs
Logical Standby
Database
RFS ARCH Queries,
arch ping Reports,
ARCH Testing,
Backups
redo to resolve gap
Archived
Archived Redo Logs
Redo Logs
8
Physical Standby (Data Guard Redo Apply)
Open
Read-Only
Primary Data Guard Physical Standby
Database Broker Database
Redo Apply
Network
Backup
Redo Shipment
Standby DIGITAL DATA STORAGE
Redo Logs
Physical Standby Database is a block-for-block copy of the primary database
Uses the database recovery functionality to apply changes
While apply is active can be opened in read-only mode for reporting/queries*
Can also be used for fast* backups, further offloading work from production
database
* Requires additional license for Oracle Active Data Guard
9
Logical Standby (Data Guard SQL Apply)
Additional
Indexes &
Materialized Views
Primary Logical Standby
Database Data Guard Database
Broker
Transform Redo
to SQL and Apply
Network Open
Read - Write
Redo Shipment Standby
Redo Logs
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 redo data is being applied via SQL
Can create additional indexes and materialized views for better query performance
10
Physical or Logical Standby?
Physical Standby Logical Standby
• Physical, block-for-block copy • Logical, transaction-for-
of the primary transaction copy of the
• Can be open for read-only primary
queries – supports real-time • Allows creation of additional
reporting in 11g objects, modification of
• At role transition, offers objects
assurance that the standby • Able to skip apply on certain
database is an exact replica of objects
the old primary • Is open read-write (data in
• Can be used for fast backups tables maintained by SQL
– new in 11g Apply can not be changed)
• Higher performance • Supports real-time reporting
• Has datatype restrictions
11
Flexible Data Protection Modes
Protection Mode Risk of Data Loss Redo Shipment
Maximum Protection Zero Data Loss Synchronous redo
Double Failure Protection shipping
Maximum Availability Zero Data Loss Synchronous redo
Single Failure Protection shipping
Maximum Performance Potential for Asynchronous redo
Minimal Data Loss shipping
Balance cost, availability, performance, and transaction protection
12
Protection from Human Errors
Flashback Database or Delayed Apply
Primary Site Delayed Apply or Standby Site
Flashback Database
Data Changes
Delay application of changes at standby to allow for the detection of user
errors or log corruptions, and prevent standby from being affected.
Administrators may choose not to configure any delay – if both primary and
standby are affected, then they can be simply flashed back (Oracle 10g)
LOG_ARCHIVE_DEST_3='SERVICE=stbyC DELAY=120'
-- Override default DELAY for physical and logical standby
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE NODELAY;
SQL> ALTER DATABASE START LOGICAL STANDBY APPLY NODELAY;
13
Role Transition
• Switchover
• Planned role reversal
• No database reinstantiation required
• Used for maintenance of OS or hardware
• Failover
• Unplanned failure of primary
• Use Flashback Database to reinstante original primary
• Possible targets for transition
• Physical and logical standby
• Not snapshot standby
• Manually execute via simple SQL / GUI interface, or
• Automate failover using Data Guard Fast-Start Failover
14
Fast-Start Failover
Standby Site
Primary Site Primary
StandbySite
Site
Observer
Steady state - Data Guard Observer Process monitors the state of the configuration
Disaster strikes and an automatic failover is executed
When repaired - the Observer reinstates the original primary as a new standby
15
SQL Apply – Rolling Database Upgrades
Upgrade
Redo Patch Set
Clients Upgrades
A B Logs A B
Queue
Major
Version X Version X X X+1 Release
1 SQL Apply Config 2 Upgrades
Initial Upgrade node B to X+1
Redo Redo Cluster
Upgrade
A B A B
Software &
Hardware
Upgrades
X+1 X+1 X X+1
Switchover
4 to B, upgrade A Run
3 in mixed mode to test
16
Data Guard Management Interfaces
• SQL*Plus Command Line
• Requires connecting to each database, primary and standby
• Data Guard Broker
• Data Guard management infrastructure
• DMON process running on all databases in Data Guard
configuration
• Attach to any database in Data Guard configuration and
manage all databases as a single configuration
• DGMGRL Command line utility
• Enterprise Manager Grid Control
17
Agenda
• Overview <Insert Picture Here>
• Oracle 11g New Features
18
Data Guard 11g Enhancements
Increase ROI High Availability
• Active Data Guard • Faster Redo Apply
• Real-time Query • Faster failover & switchover
• Fast Incremental backup • Fast-Start Failover using
• Snapshot Standby
ASYNC
• Transient Logical Standby
Better Data Protection Manageability
• Advanced Compression • Logical Standby
• Redo compression for GAPs • RMAN Integration
• Lost-write protection • Security
• Fast-Start Failover • Mixed Windows/Linux
• Enterprise Manager & Broker
19
Traditional Physical Standby Databases
Investment in Disaster Recovery only
Real-time
Queries
Production Standby
Database Database
• Applications, backups, reports run on production only
20
Active Data Guard 11g
Real-time Query
Real-time
Real-time
Query
Queries
Continuous Redo
Shipment and Apply
Production Physical Standby
Database Database
• Offload read-only queries to physical standby
• Offload fast incremental backups to physical standby
21
Active Data Guard 11g
Real-time Query
-- Physical standby database is mounted and being recovered.
-- 1. Open physical standby database to support recovery and reporting.
-- Stop recovery on physical standby database.
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
-- Open physical standby in read-only mode.
ALTER DATABASE OPEN;
-- Restart recovery on physical standby database.
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE
DISCONNECT FROM SESSION;
-- Users can now run queries or reports on opened physical standby database
-- while recovery is active.
22
Active Data Guard 11g
Real-time Query
-- 2. Stop reporting on physical standby database and just run recovery.
-- Stop recovery on opened physical standby database.
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
-- Close physical standby database so it goes back in mount mode.
ALTER DATABASE CLOSE;
-- Restart managed recovery on physical standby database.
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE
DISCONNECT FROM SESSION;
23
Snapshot Standby
Use Standby Database for Testing
Updates Queries
Updates
Primary Physical Standby
Snapshot
Database Database
Database
• Preserves zero data loss – continuous redo transport while open read-write
• Similar to storage snapshots, but provides continuous DR using same storage
• Can also be done using Data Guard 10g Release 2 – but more manual steps
24
Snapshot Standby
Using Oracle 10g and 11g
10.2 – Steps Required 11.1 – Steps Required
Standby Standby
> alter database recover managed standby database > alter database convert to snapshot standby;
cancel; PERFORM TESTING, ARCHIVE LOGS CONTINUE TO BE
> create restore point before_lt guarantee flashback SHIPPED
database;
> alter database convert to physical standby;
Primary
> alter system archive log current;
> alter system set log_archive_dest_state_2=defer;
Standby
> alter database activate standby database;
> startup mount force;
> alter database set standby database to maximize
performance;
> alter system set log_archive_dest_state_2=defer;
> alter database open;
PERFORM TESTING, ARCHIVE LOGS NOT SHIPPED
> startup mount force;
> flashback database to restore point before_lt;
> alter database convert to physical standby;
> startup mount force;
> alter database recover managed standby database
disconnect from session;
Primary
> Alter system set log_archive_dest_state_2=enable
25
Network Compression for GAPs
Improved Data Protection
• Data Guard 11g can automatically compress data
transmitted to resolve archive log gaps
LOG_ARCHIVE_DEST_3='SERVICE=denver SYNC COMPRESSION=ENABLE‘
• Largest benefit in bandwidth constrained
environments
• Reduce transmission time 15-35%
• Reduce bandwidth consumption by 35%
• Faster gap resolution = better data protection
• Requires Oracle 11g Advanced Compression Option
26
Lost Write Detection
• Faulty storage hardware / firmware may lead to lost
writes leading to data corruptions
• Occurs when an I/O subsystem acknowledges the completion
of the block write, when the write did not occur in the
persistent storage
• On a subsequent block read, the I/O subsystem returns the
stale version of the data block, which might be used to update
other blocks of the database
• Very hard to diagnose such data corruptions when they occur
• Address lost writes using Data Guard physical
standby
• Set initialization parameter
DB_LOST_WRITE_PROTECT on primary and standby
27
Lost Write Detection
• Compare versions of blocks on the standby with that in the
incoming redo stream from primary
• If primary block SCN is lower than standby block SCN:
• Lost write occurred on primary
• Failover to standby and recreate primary
• If primary block SCN is greater than standby block SCN:
• Lost write occurred on standby
• Recreate standby database or affected data files
• In both cases, standby alert.log and trace file contain reason for
failure
• Largest increase in protection with very little impact is achieved
by enabling DB_BLOCK_CHECKSUM (TYPICAL= 1-2%, FULL=4-
5%) and DB_LOST_WRITE_PROTECT (<5%)
28
Enhanced Fast-Start Failover
High Availability
• Automatic failover for Maximum Performance Mode
• Data Guard configurations using ASYNC redo transport
• Configure number of seconds between apply point and redo
generation point via Data Guard Broker property
FastStartFailoverLagLimit
• Default setting = 30 seconds
• Minimum threshold = 10 seconds
• If a standby database is within the limit, defined by
FastStartFailoverLagLimit, it is a candidate for Fast-
Start failover.
• High Availability for Fast-Start Failover Observer
• Automatically restart the Data Guard Observer on a second
host if the primary Observer host fails
29
User-Configurable Fast-Start Failover
High Availability
• Immediate automatic failover for user-configurable health conditions using
• DGMGRL Command ENABLE FAST_START FAILOVER
• PL/SQL Package DBMS_DG.INITIATE_FS_FAILOVER
DGMGRL> ENABLE FAST_START FAILOVER [ CONDITION value ];
Enabled.
DGMGRL> SHOW FAST_START FAILOVER;
Fast-Start Failover: ENABLED
Threshold: 30 seconds
Target: DR_Sales
Observer: (none)
Lag Limit: 30 seconds
Shutdown Primary: TRUE
Auto-reinstate: TRUE
Configurable Failover Conditions
Health Conditions:
Corrupted Controlfile YES
Corrupted Dictionary YES
Inaccessible Logfile NO
Stuck Archiver NO
Datafile Offline YES
Oracle Error Conditions: (none)
30
Faster Role Transitions
High Availability
• Faster Failover
• Failover in seconds with Fast-Start Failover
• Faster Redo Apply for physical standby
• Parallel media recovery optimization
• Benefits all workloads
• Faster SQL Apply for logical standby
• Performance benefit for certain workload profiles
• e.g. inserts & updates to tables that are not partitioned
• Support for executing DDL in parallel on standby database
31
Rolling Upgrade Using Physical Standby
High Availability
• Transient Logical Standby
Physical • Execute rolling database upgrades using a
physical standby database
• Temporarily convert physical standby to logical
Logical to perform the upgrade
ALTER DATABASE RECOVERY TO LOGICAL
STANDBY KEEP IDENTITY
Upgrade
• Potential impact of SQL Apply data type
restrictions limited to shorter upgrade window
• When upgrade is complete – revert to physical
Physical standby
• No need for separate logical standby
32
Logical Standby
Manageability
• XMLType data type (CLOB)
• Transparent Data Encryption (TDE)
• DBMS_FGA (Fine Grained Auditing)
• DBMS_RLS (Virtual Private Database)
• Role-specific DBMS_SCHEDULER jobs
• (PRIMARY, LOGICAL STANDBY, BOTH)
• Dynamic SQL Apply parameter changes
• Support for Parallel DDL execution on the standby
database
• Switchover no longer requires prior shutdown of RAC
nodes
33
Enhanced RMAN Integration
Manageability
• Block-change tracking on physical standby database
• Enables fast incremental backup on standby
• Requires Active Data Guard option
-- Enable block change tracking
ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE ‘<file> REUSE;
-- Disable block change tracking
ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;
• RMAN duplicate for standby - no intermediate storage required
DUPLICATE TARGET DATABASE FOR STANDBY FROM ACTIVE DATABASE
SPFILE PARAMETER_VALUE_CONVERT '/u01', '/u02'
SET DB_UNIQUE_NAME = ‘FOO’
SET LOG_FILE_NAME_CONVERT = '/u01','/u02'
SET DB_FILE_NAME_CONVERT = '/u01','/u02';
• Archived logs deleted when shipped or applied to any standby
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON [ ALL ] STANDBY;
34
Enhanced Data Guard Security
Manageability
• SYS user and password files no longer required for
redo transmission authentication
• Authentication possible using SSL - requires ASO, OID
• Uses PK Certificates
• Requires all Data Guard databases to be in the same
enterprise domain
• Authentication still possible using a password file
(default)
• Non-SYS user can be specified through the parameter
REDO_TRANSPORT_USER
• This user must have the SYSOPER privileges
• Requires password for this user to be the same at primary
and all standbys
35
More Flexible Configurations
Manageability
• Increased flexibility in Data Guard configurations
• Data Guard 10g supports mixed word-sizes (32-bit and 64-
bit) in the same configuration
• Data Guard 11g supports mixed Windows/Linux
• Physical standby only
• Same endianess required on all platforms
• Reference: MetaLink Note 413484.1 – Data Guard
Support for Heterogeneous Primary and Standby
Systems
36
Data Guard Broker
Manageability
• Numerous Fast-Start Failover enhancements
• No bounce required to change protection modes
between Maximum Performance and Maximum
Availability
• Also backported to 10.2.0.3
• New Property DGConnectIdentifier simplifies
database connection definitions
• Same as service name defined in LOG_ARCHIVE_DEST_n
37
Enterprise Manager Grid Control
Manageability
• Create standby databases from existing RMAN
backup
• Create RAC standby database from a RAC primary
• Automated standby clones for reporting,
development, and test
• Automatic propagation of Enterprise Manager jobs
and thresholds to new primary following role transition
• Enterprise Manager Data Recovery Advisor utilizes
standby databases for Intelligent Data Repair (IDR).
38
For More Information
• Oracle Database 11g
• http://www.oracle.com/technology/products/database/or
acle11g/index.html
• Oracle High Availability Portal
• http://www.oracle.com/technology/deploy/availability/
• Oracle 11g Education (http://education.oracle.com)
• Oracle 11g: New features for Administrators
• Oracle 11g: Administration Workshop I and II
• Oracle Database 11g Documentation
• http://www.oracle.com/pls/db111/homepage
• Metalink Notes
• Note 413484.1 – Data Guard Support for Heterogeneous Primary and
Standby Systems
• Note 387266.1 – Data Guard Switchover and Failover Best Practices
39
For More Information
http://search.oracle.com
Data Guard
or
http://www.oracle.com/
40
41