Upload
dotu
View
228
Download
0
Embed Size (px)
Citation preview
DATA GUARD and
FLASHBACK – Stress
Testing, HotFixes and Data
Recovery
April Sims
Southern Utah University OCP 8i,9i,10g
Contributing Editor
If you want to become an
author or reviewer….
Standbys - 10gR2
Physical
• Block for Block Copy
• REDO APPLY
• Data Loss
Protection Modes
• Can be used for
reporting – not kept
current with
production
Logical
• Read-only
• SQL APPLY
• Add R/W schemas
• Some DDL skipped
• Datatype issues
• Reporting Instance
– current with
primary
DATA GUARD
• Role Management Services – Failovers and
Switchovers
• Reduces Errors
• Less Manual Intervention
• Faster Transitions
• More work to fail over different clients
• Heterogeneous Environment – More support
in 11g
Node BNode A
REDO APPLY
PRIMARY STANDBY
STANDBYPRIMARY
Node BNode A
REDO APPLY
DOWNSTANDBY
STBY> ALTER DATABASE
RECOVER MANAGED
STANDBY DATABASE FINISH
FORCE;
STBY> ALTER DATABASE
COMMIT TO SWITCHOVER
TO PRIMARY;
STANDBYPRIMARY
Node BNode A
REDO APPLY
DOWN STANDBY
STANDBYPRIMARY
Node BNode A
REDO APPLY
DOWN PRIMARY
PRMY> ALTER DATABASE
OPEN;
April Sims
DATA GUARD
DBA
Multiple Disaster Recovery Sites
Local Site
• Different Building, Same
City Block
• Different Subnet
• RTO* – 30 minutes
• Linux RH 4 (64-bit) AMD
• No data loss
• Logical Standby –
Reporting only
Remote Site
• 80 miles away
• Different IP, Exterior DNS
• VPN Tunnel
• RTO* – 24 hours
• SAME HARDWARE as
production
• No data loss
• Logical Standby data
already duplicated
*RTO – Recovery Time Objective
FLASHBACK
PRIMARY DATABASE
• Revert Logical Corruption
• Unroll patch or hot fix
• Similar to a full database
restore
• Affects ALL USERS!
STANDBY DATABASE **
• Physical Corruption
• Logical Corruption
• Vendor Upgrade
• Batch Job Reversal
• Untested Hot Fix, Patch
• Stress Testing
• Restore datafile *see Notes
• Oracle Upgrades
• Reinstate Primary
• ASM or RAC Migration
• Affects minimal number of
USERS!
**Different init.ora parameters
GUARANTEED RESTORE POINTS
• Requires FLASHBACK to be enabled
• Highly recommended
• Easy to convert back to correct SCN
• Resume role as physical standby
FLASHBACK STANDBY
PRMY> ALTER SYSTEM ARCHIVE LOG CURRENT;
PRMY> ALTER SYSTEM SET DG_BROKER_START=FALSE;
PRMY> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=DEFER;
REDO APPLY is no longer running, Broker is automatically re-
enabled if not turned off. Logs aren’t shipping. All of these
things change in 11g!
STBY> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
STBY> CREATE RESTORE POINT HOTFIX1 GUARANTEE FLASHBACK DATABASE;
STBY> ALTER DATABASE ACTIVATE STANDBY DATABASE;
TEST……..…..remember Recovery Time Objective
After Testing….Revert
STBY> STARTUP MOUNT FORCE;
STBY> FLASHBACK DATABASE TO RESTORE
POINT HOTFIX1;
STBY> ALTER DATABASE CONVERT TO PHYSICAL
STANDBY;
STBY> STARTUP MOUNT FORCE;
STBY> ALTER DATABASE RECOVER MANAGED
STANDBY DATABASE USING CURRENT
LOGFILE DISCONNECT;
(*using REAL-TIME APPLY)
11g Features and Benefits
• Snapshot Database
• Active DATA GUARD
• RMAN
• Real Application Testing
• Flashback Transaction
• Fast Start Failover
• Redo – Compression and SSL Authentication
• Lost-Write Detection
• Live Database Duplication Over Network
11g
Snapshot
Database
• Data Frozen
• Receives Redo but not
applied
• Can be read-only
(reporting)
• Can be read-write (testing)
• Requires Flash Recovery
Area
• Less steps than in 10g
• Archival Purpose?? *
Third type of
standby….
* Not to be confused with RMAN Archival Backups
11g - ACTIVE DATA GUARD
• PHYSICAL Standby
• Open for reporting
• Current with Primary
• Unable to add additional R/W schemas,
summations, indexes, MV as with Logical
Standby
• Dual functionality - disaster recovery &
reporting solution.
• Less Errors, Issues as with Logical
• $$$$
11g - RMAN Changes
• DBID – Identical for Primary and Physical
Standby, Identical is option for Logical
• BLOCK CHANGE TRACKING – Faster
incremental backups
• DB_UNIQUE_NAME – backups available for
restore to all standbys and primary but they
may not be accessible – disk or image
backups
• ARCHIVE DELETION POLICY – critical for
DG implementations
Must restore application
data to SCN by….
• Point-in-time recovery
• Flashback Database
• Import/Export
TAKE A SNAPSHOT
11g- Real
Application
Testing
More 11g Stuff….
• FLASHBACK TRANSACTION – useful for
primary instance
• FAST START FAILOVER – conditions
• REDO TRANSPORT – protects archive logs
(can be data mined) with SSL authentication
• LOST WRITE DETECTION – writes that don’t
make it to disk
11g DATABASE DUPLICATION
OVER NETWORK
• Live Backup – can use either the primary or
the standby database or backups of either
DUPLICATE TARGET DATABASE FOR
STANDBY FROM ACTIVE DATABASE
DORECOVER;
• If duplicated on same box use
SET NEWNAME FOR DATAFILE,TEMPFILE…
( * docs/references - couple of wrong examples)
http://download.oracle.com/docs/cd/B28359_01/server.111/b28294
/rcmbackp.htm#sthref1563 equal signs and “ instead of ‘
http://www.dbaexpert.com/blog/?p=27
Oracle Database Experts
Maintained by Charles Kim
Data Guard 11g Database Duplication Over Network Logfile
Posted in August 13th, 2007
by ckim in Data Guard
orapwd file=$ORACLE_HOME/dbs/orapwDBA11g entries=25 password=oracle123
DBA11gDR > ./dup.ksh
Recovery Manager: Release 11.1.0.6.0 - Production on Mon Aug 13 21:46:38 2007
Copyright (c) 1982, 2007, Oracle. All rights reserved.
RMAN>
connected to target database: DBA11G (DBID=231973368)