You are on page 1of 28

<Insert Picture Here>

Oracle Data Guard


Active Data Guard
Agenda

• Data Guard Architecture & Features <Insert Picture Here>

• Data Guard 11g New Features


• Active Data Guard
• Resources

2
What is a Disaster?

• Well-recognized disasters such as headline-grabbing events


• Fire, earthquake, tsunami, flood, hurricane, …
• And . . .more mundane events that occur much more frequently
• Faulty system components – server, network, storage, software, …
• Data corruptions
• Backup/recovery of bad data
• Wrong batch job
• Bad HW/SW installations / upgrades / patching
• Operator errors
• Power outages
• Etc.

3
What is Data Guard?
• Data Availability & Data Protection solution for Oracle
• Automates the 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,
testing, or backups while in standby role
• An included feature of Oracle Database Enterprise Edition

4
Oracle’s Integrated HA Solution Set

System
Real Application Clusters

Oracle MAA Best Practices


Failures
Unplanned ASM
Downtime Data
Flashback
RMAN & Oracle Secure Backup
Failures Data Guard
Streams

System Online Reconfiguration


Planned Changes Rolling Upgrades
Downtime
Data
Online Redefinition
Changes

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
Transactions Physical/Logical
Oracle Net
Standby Database

MRP - physical
LGWR LNS RFS LSP - logical
sync

Standby
async Redo
Online Transform Redo
Logs to SQL for
Primary Redo Logs arch
Logical Standby
Database
ARCH Queries,
Reports,
ARCH Testing,
Backups

Archived
Archived Redo Logs
Redo Logs

7
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 the production database

* Requires additional license for Oracle Active Data Guard

8
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

9
SQL Apply Process Architecture

Logical Change Records not


grouped into transactions

Redo
LCR
Redo Data Records
LCR
from Reader Preparer : Builder
Primary
Database Shared
Pool

Log Mining
Transaction
groups
Apply Processing

Logical
Standby Applier Coordinator Analyzer
Database
Transactions Transactions sorted
to be applied in dependency order

10
Redo Apply or SQL Apply?
Redo Apply SQL Apply
• Physical, block-for-block copy • Logical, transaction-for-
of the primary transaction copy of the primary
• Can be open for read-only • Allows creation of additional
queries – supports real-time objects, modification of objects
reporting in 11g • Able to skip apply on certain
• At role transition, offers objects
assurance that the standby • Is open read-write (data in
database is an exact replica of tables maintained by SQL
the old primary Apply can not be changed)
• Can be used for fast backups • Supports real-time reporting
• Higher performance • Has datatype restrictions

11
Protection from Human Errors
Flashback Database or Delayed Apply

Primary Site Delayed Apply or Standby Site


Flashback Database

Data Changes

 Application of changes received from the primary can be delayed at standby


to allow for the detection of user errors and prevent standby to be 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)
 The apply process also revalidates the log records to prevent application of
any log corruptions

12
Switchover and Failover

• 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

• Manually execute via simple SQL / GUI interface, or


• Automate failover using Data Guard Fast-Start Failover

13
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

14
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 ASYNC
• Snapshot Standby • Transient Logical Standby

Better Data Protection Manageability


• Faster redo transport • SQL Apply
• Advanced Compression • RMAN Integration
• Redo compression for GAPs • Security
• Lost-write protection • Mixed Windows/Linux
• Fast-Start Failover • Enterprise Manager & Broker

15
Traditional Physical Standby Databases
Investment in Disaster Recovery only

Real-time
Queries

Production Standby
Database Database

• Applications, backups, reports run on production only

16
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

17
Active Data Guard Benefits
Invest in improving Quality of Service

Physical standby in recovery Simultaneous read & recovery

All read activity on production Shift read-only workload to standby

Disaster protection only Performance protection

Standby systems rarely used Regularly used for production

Complex replication used to Simple, high performance,


create reporting replica application and data transparent

18
Active Data Guard - Licensing

• A Database Option for Oracle Enterprise Edition 11g


• Option license is required only when using either:
• Real-time Query
• RMAN block-change tracking on a standby database

• Used in conjunction with Data Guard functionality


included with Oracle11g Enterprise Edition

19
How to Setup a Standby Database
10g 11g
1. Prepare the primary database. 1. Prepare the primary database.
2. Back up the primary database. 2. Configure Oracle Net Services.
3. Copy files to the standby 3. Prepare the standby database.
system. 4. Duplicate database over
4. Set parameters on the physical network.
standby database. 5. Start the standby database.
5. Start the standby database. 6. Use DataGuard to set
6. Configure Oracle Net Services. parameters for transport and
7. Set parameters on the primary appy services.
database.
8. Start the transport of redo.

20
Prepare Primary Database

• Enable archiving mode


• Force logging
• Set parameters
• db_unique_name
• db/log_file_name_convert

21
Configure Oracle Net Services

• Create tnsnames entries on both sides


• primary node: primary service
• standby node: standby service
• Add a static service definition in the listener.ora file:
SID_LIST_LISTENER=(SID_LIST=
(SID_DESC=(SID_NAME=sid_name)
(GLOBAL_DBNAME=db_unique_name_DGMGRL.db_domain)
(ORACLE_HOME=oracle_home)))
• Start the listeners on both sides

22
Prepare the Standby Database

• Create password file


orapwd file=$OH/dbs/orapw<sid> password=<pwd> ignorecase=y
• Create a parameter file containing simply db_name
init<stbysid>.ora: db_name = <db name>
remote_log_password_file = exclusive
sql> startup nomount
• Optionally include parameters like db_file_name_convert
• Create log directories where required

23
Duplicate the Primary Database Over
the Network
• Startup standby instance
• sql> startup nomount
• Duplicate using RMAN
connect target sys/…@porcl
connect auxiliary sys/…@sorcl

duplicate target database


for standby
from active database
spfile parameter_value_convert = ('control','ctrl')
set db_unique_name = 'SORCL'
set sga_target = '200m'
set log_file_name_convert = '/ORCL','/SORCL'
set db_file_name_convert = '/ORCL','/SORCL'
nofilenamecheck
;

24
Setup Dataguard Broker

• Create standby redo log files on both databases


• Start Broker
sql> alter system set dg_broker_start = true
• Create Dataguard Configuration
• Enterprise Manager
• dgmgrl

DGMGRL> connect …
DGMGRL> create configuration …
DGMGRL> enable configuration;
DGMGRL> add database …
DGMGRL> enable database …

25
Configure Dataguard Attributes

• Use Logwriter and set other attributes


connect sys/..@porcl

edit database 'PORCL'


set property standbyarchivelocation = '/u03/oracle/archive/ORCL'
;
edit database 'PORCL‘ set property logxptmode = 'sync';

edit database 'SORCL'


set property standbyarchivelocation = '/u03/oracle/archive/SORCL'
;
edit database 'SORCL‘ set property logxptmode = 'sync';

show database verbose 'PORCL';


show database verbose 'SORCL';

26
Use the Standby Database – Active
Dataguard
• Disable redo apply
dgmgrl> edit database ‘SORC’ set state = ‘apply-off’;

• Open the standby database


sql> alter database open;

• Enable redo apply


dgmgrl> edit database ‘SORC’ set state = ‘apply-on’

27
Enterprise Manager Grid Control

• …or let Grid Control do the work to create the standby


database!

28

You might also like