data guard concepts
TRANSCRIPT
© Puget Sound Oracle Users GroupEducation Is Our Passion
PSOUG EducationEducation Is Our Passion
Hands-on Workshop Series
Oracle DataGuard 10gR2
© Puget Sound Oracle Users GroupEducation Is Our Passion
Daniel A. [email protected]
© Puget Sound Oracle Users GroupEducation Is Our Passion
We Do Not Practice:
Slow Death by PowerPoint
© Puget Sound Oracle Users GroupEducation Is Our Passion
DiscussionOracle Data Guard Overview
© Puget Sound Oracle Users GroupEducation Is Our Passion
Data Guard History
7.3: Custom Standby Database
8i: Automated Standbyread-only databasemanaged recoveryremote archiving
8i: Data GuardAutomationSingle command switch-overSingle command fail-overOracle Parallel Fail Safe (OPFS) 1993
1997Oracle8i
Oracle8Oracle7
1999
Oracle9i20012004 Oracle 10g
2007 Oracle 11g
© Puget Sound Oracle Users GroupEducation Is Our Passion
Data Guard History
9iR1: Data GuardIntegrated zero-data-loss capabilityData Guard Broker w/ Data Guard Manager GUICommand Line Interface (CLI)Switchover and Failover operationsAutomatic gap resolutionAutomatic Synchronization
9iR2: Data GuardLogical standby databasesMaximum protection / availabilityEnhanced Data Guard BrokerCascaded redo log destinations
19931997
Oracle8iOracle8
Oracle7
1999
Oracle9i20012004 Oracle 10g
2007 Oracle 11g
© Puget Sound Oracle Users GroupEducation Is Our Passion
Data Guard History10gR1: Data Guard
Real-time applyRecovery through OPEN RESETLOGSSimplified configuration with VALID_FOR attributeStandby redo log support on logical standby databasesImproved redo transmission securityImproved support for RACZero downtime instantiationof logical standby databases
10gR2: Data GuardFast-start FailoverFlashback Database across Data Guard switchoversAsynchronous Redo TransmissionFaster Redo Apply failover 1993
1997Oracle8i
Oracle8Oracle7
1999
Oracle9i20012004 Oracle 10g
2007 Oracle 11g
© Puget Sound Oracle Users GroupEducation Is Our Passion
Fast Start FailoverFast-start failover: Automatically, quickly, and reliably fail over to a designated, synchronized standby databaseAfter a fast-start failover occurs, the old primary database is automatically reconfigured as a new standby database upon reconnection to the configuration. Maintain uptime and increase the availability, as well as the robustness of disaster recovery.Less need for manual intervention.
© Puget Sound Oracle Users GroupEducation Is Our Passion
Flashback Database across Switchovers
It is now possible to flash back the primary and standby databases to an SCN or a point in time prior to a switchover operation. When you use this feature of Flashback Database on a physical standby database, the standby role is preserved. On a logical standby database, the role of the standby database is changed to what it was at the target SCN or time.
© Puget Sound Oracle Users GroupEducation Is Our Passion
Asynchronous Redo TransmissionAsynchronous redo transmission using the log writer process (LGWR ASYNC) has been improved to reduce the performance impact on the primary database. During asynchronous redo transmission, the network server (LNSn) process transmits redo data out of the online redo log files on the primary database and no longer interacts directly with the log writer process.Allows the log writer process to write redo data to the current online redo log file and continue processing the next request without waiting for interprocess communication or network I/O to complete.
© Puget Sound Oracle Users GroupEducation Is Our Passion
DiscussionData Guard Concepts
© Puget Sound Oracle Users GroupEducation Is Our Passion
Causes of Data Loss
Source: Disaster Recovery Journal
Natural disasters 3%
Software corruption 4%
Computer viruses 7%
Human errors 36%
Hardware & system errors 49%
© Puget Sound Oracle Users GroupEducation Is Our Passion
Fault Tolerance
Real Application ClustersReal Application ClustersContinuous Availability for all ApplicationsContinuous Availability for all Applications
Data Data GuardGuardGuaranteedGuaranteed Zero Data Zero Data LossLoss
FlashbackFlashbackGuaranteedGuaranteed Zero Data LossZero Data Loss
SystemMaintenance
PlannedDowntime Database
Maintenance
Dynamic ReconfigurationDynamic ReconfigurationCapacity on Demand without InterruptionCapacity on Demand without Interruption
Online RedefinitionOnline RedefinitionAdapt to Change OnlineAdapt to Change Online
ASM MirroringASM MirroringStorage Failure ProtectionStorage Failure Protection
HumanError
SiteFailures
Storage/NetFailures
UnplannedDowntime
SystemFailures
© Puget Sound Oracle Users GroupEducation Is Our Passion
Data Guard Acronyms
ARC0 ArchiverDMON Data Guard MonitorFAL Fetch Archive LogLCR: Logical Change RecordLGWR Log Writer backend processLSP: Logical Standby Process aka SQL Apply (logical)
MRP Managed Recovery Process aka Redo Apply (physical)
RFS Remote File Server (receives undo)
TAF Transparent Application Failover
© Puget Sound Oracle Users GroupEducation Is Our Passion
A Complete High-Availability Solution
Recovery Manager (RMAN)Flashback Database / Query / TableStreams ReplicationGrid ControlReal Application Clusters (RAC)Data Guard
Data Guard is one part of a complete HA solution
© Puget Sound Oracle Users GroupEducation Is Our Passion
What is Data Guard?
Real-time replicationPrimarily intended for replication between data centersUtilizes Log Miner to read redo logsShips redo to remote site via Advanced QueuingMost often applies changes to a standby databaseCan cascade changes from standby-to-standby
Built by the same team that wrote RMAN, Streams, and Change Data Capture
© Puget Sound Oracle Users GroupEducation Is Our Passion
Why Data Guard?
High Availability (HA) Disaster PreparationReplication between geographically separated data centers
Transparent Application Failover (TAF) Remove backup process overhead from primary production systemsRolling hardware and operating system upgrades and system maintenanceRolling database upgrades and patchingProduction mirror for reportingSystem migration (for example to ASM)
© Puget Sound Oracle Users GroupEducation Is Our Passion
What is a Standby DatabaseA copy of a production database that you can use for disaster protection. You can update the standby database with archived redo logs from the production database in order to keep it current. If a disaster destroys the production database, you can activate the standby database and make it the new production database.You can maintain the standby data in one of the following modes:
For physical standby databasesRedo ApplyOpen read-only mode
For logical standby databasesOpen read/write mode
A Standby Database is NOT Data Guard
© Puget Sound Oracle Users GroupEducation Is Our Passion
Types of Standby DatabasesThere are two types of standby databases
Physical standby databaseblock-for-block identical with the primary databaseSynchronized with the primary database by application of redo data
Logical standby databaseShares the same schema definitionSynchronized with the primary database by transforming the data in the redo received from the primary database into SQL statements that are executed
© Puget Sound Oracle Users GroupEducation Is Our Passion
Oracle Data Guard Architecture
Network Broker
ProductionDatabase
Logical StandbyDatabase Open for
Reports
SQLApply
Transform Redo to SQL
AdditionalIndexes & MVs
Physical StandbyDatabase
DIGITAL DATA STORAGE
DIGITAL DATA STORAGE
Backup
Redo Apply
Sync or Async Redo Shipping
© Puget Sound Oracle Users GroupEducation Is Our Passion
Database Protection Modes
Maximum ProtectionNo Data Loss and No data divergenceArch_dest: mandatory, lgwr, sync, affirmPrimary db shutdown when unable to access stdby
Maximum AvailabilityArch_dest: mandatory, lgwr, sync, affirmProtection auto lowered when stdby is unavailable
Maximum PerformanceArch_dest: lgwr/arch, sync/async, mandatory/optionalMinimal performance impact
© Puget Sound Oracle Users GroupEducation Is Our Passion
Protection Modes and Requirements
No Yes for ASYNCASYNC or SYNC
MAXPERFORMANCE
YesYes SYNCMAXAVAILABILITY
No Yes SYNCMAXPROTECTION
Used with Fast-Start Failover?
Standby Redo Log Files Needed?
Redo Transport
Protection Mode
© Puget Sound Oracle Users GroupEducation Is Our Passion
Data Guard Services
Log transport servicesConfigurable using ARCH or LGWRUsed by Data Guard and Streams
Log apply servicesRedo Apply (Physical Standby)
Recovers the redo data received from the primary database and applies the redo to the physical standby database.
SQL Apply (Logical Standby)Transforms the data in the redo received from the primary database into SQL statements and then executes the SQL statements on the standby database.
Role-management serviceswhat do it do?
© Puget Sound Oracle Users GroupEducation Is Our Passion
© Puget Sound Oracle Users GroupEducation Is Our Passion
DiscussionData Guard Architecture
Physical Standby
© Puget Sound Oracle Users GroupEducation Is Our Passion
PSOUG Lab Topology
Public Network
Production
Data Center 1
Public Network
10/100 Ethernet Switch
Standby
Data Center 2
GigEthernet Switches
Separate Storage
End Users Connecting Directly or Through An
Application Server
© Puget Sound Oracle Users GroupEducation Is Our Passion
Oracle Data Guard: Architecture
LGWR
Primary database
transactions
Onlineredologs
ARC0
FAL
RFS
MRP or LSP
Archived redo logs
ARC0
Standbydatabase
Reports
(MRP only)
Standbyredo logs
Archived redo logs
BackupOra
cle
net
© Puget Sound Oracle Users GroupEducation Is Our Passion
Standby Redo Logs
Redo from primary database
RFS ARC0
Standbyredo logs
Archivedredo logs
MRP/LSP
Standby database
© Puget Sound Oracle Users GroupEducation Is Our Passion
Physical Standby Database
Public Network
Production
Data Center 1
Public Network
Standby
Data Center 2
Redotransport Redo
apply
Redo stream
End Users Connecting Directly or Through An
Application ServerTo Either or Both
© Puget Sound Oracle Users GroupEducation Is Our Passion
Logical Standby Database
Public Network
Production
Data Center 1
Public Network
Standby
Data Center 2
End Users Connecting Directly or Through An
Application ServerTo Either or Both
Transform redo into SQLand execute
Reports
© Puget Sound Oracle Users GroupEducation Is Our Passion
Redo records
LCRLCR
:
Shared pool
Transaction groups
Transactions sorted in
dependency order
Log Mining
Apply processing
Logical change records not grouped into transactions
Transactions to be applied
Reader Preparer Builder
AnalyzerCoordinatorApplier
Data files
Redo data from primary database
SQL Apply Process: Architecture
© Puget Sound Oracle Users GroupEducation Is Our Passion
Real Time Apply
Redo data is applied to the standby database as soon as it is received from the primary database
In Oracle9i Data Guard this apply has to wait till an archivelog iscreated on the standby database
For Redo Apply:ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE
For SQL Apply:ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE
When real time apply is enabled, RECOVERY_MODEcolumn in V$ARCHIVE_DEST_STATUS displays “MANAGED REALTIME APPLY”
© Puget Sound Oracle Users GroupEducation Is Our Passion
Real-Time Apply
RFS
Standbyredo log
files
MRP or LSP
ARC0
Primary database
Standby database
Archivedredo log
files
© Puget Sound Oracle Users GroupEducation Is Our Passion
Real-Time Apply Architecture
PhysicalLogicalStandbyDatabase
MRP/ LSPRFS
StandbyRedo Logs
ARCH
Archived Redo Logs
Archived Redo Logs
PrimaryDatabase
Transactions
LGWR
Online Redo Logs
ARCH
Oracle Net
Real Time Apply
© Puget Sound Oracle Users GroupEducation Is Our Passion
Real Time Apply – Benefits
Standby databases now more closely synchronized with the primary
More up-to-date, real-time reportingFaster switchover and failover times
Reduces planned and unplanned downtimeBetter Recovery Time Objective (RTO) for DR
© Puget Sound Oracle Users GroupEducation Is Our Passion
DiscussionData Guard Configurations
© Puget Sound Oracle Users GroupEducation Is Our Passion
Data Guard Role Transitions
SwitchoverPlanned role reversalUsed for OS or hardware maintenance
FailoverUnplanned role reversalUse in emergencyZero or minimal data loss depending on choice of data protection mode
Role-transition operations are not automatically invoked
© Puget Sound Oracle Users GroupEducation Is Our Passion
Maximum Availability Architecture
RAC productiondatabase
RAC physicalstandby database
Oracle Application
Server
Oracle Application
Server
WAN traffic manager
Clients
Data Guard RAC logical
standby database
© Puget Sound Oracle Users GroupEducation Is Our Passion
The “Black Line”
Determine Configuration
Build Primary Data Center
Build Failover Data Center
Activate Replication
© Puget Sound Oracle Users GroupEducation Is Our Passion
Oracle Data Dictionary (1 of 2)
SQL> SELECT object_name2 FROM dba_objects3 WHERE object_name LIKE '%LOGSTDBY%';
DBA_LOGSTDBY_EVENTSDBA_LOGSTDBY_HISTORYDBA_LOGSTDBY_LOGDBA_LOGSTDBY_NOT_UNIQUEDBA_LOGSTDBY_PARAMETERSDBA_LOGSTDBY_PROGRESSDBA_LOGSTDBY_SKIPDBA_LOGSTDBY_SKIP_TRANSACTIONDBA_LOGSTDBY_UNSUPPORTEDDBMS_INTERNAL_LOGSTDBYDBMS_LOGSTDBYDBMS_LOGSTDBY_LIBGV$LOGSTDBYGV$LOGSTDBY_PROCESSGV$LOGSTDBY_PROGRESSGV$LOGSTDBY_STATEGV$LOGSTDBY_STATSGV$LOGSTDBY_TRANSACTIONGV_$LOGSTDBYGV_$LOGSTDBY_PROCESSGV_$LOGSTDBY_PROGRESSGV_$LOGSTDBY_STATEGV_$LOGSTDBY_STATSGV_$LOGSTDBY_TRANSACTIONLOGSTDBY$APPLY_MILESTONE
LOGSTDBY$APPLY_PROGRESSLOGSTDBY$EVENTSLOGSTDBY$EVENTS_INDLOGSTDBY$HISTORYLOGSTDBY$PARAMETERSLOGSTDBY$PLSQLLOGSTDBY$SCNLOGSTDBY$SKIPLOGSTDBY$SKIP_SUPPORTLOGSTDBY$SKIP_TRANSACTIONLOGSTDBY_LOGLOGSTDBY_SUPPORTLOGSTDBY_UNSUPPORTED_TABLESV$LOGSTDBYV$LOGSTDBY_PROCESSV$LOGSTDBY_PROGRESSV$LOGSTDBY_STATEV$LOGSTDBY_STATSV$LOGSTDBY_TRANSACTIONV_$LOGSTDBYV_$LOGSTDBY_PROCESSV_$LOGSTDBY_PROGRESSV_$LOGSTDBY_STATEV_$LOGSTDBY_STATSV_$LOGSTDBY_TRANSACTION
© Puget Sound Oracle Users GroupEducation Is Our Passion
Oracle Built-in PackagesSQL> SELECT DISTINCT object_name, overload2 FROM all_arguments3 WHERE package_name = 'DBMS_DRS‘4 ORDER BY 1,2;
OBJECT_NAME OVERLOAD------------------------------ --------CANCEL_REQUESTDELETE_REQUESTDG_BROKER_INFODO_CONTROL 1DO_CONTROL 2DO_CONTROL_RAW 1DO_CONTROL_RAW 2DUMP_METAGETMIVGET_PROPERTYGET_PROPERTY_OBJGET_RESPONSEGET_RESPONSE_RAWPINGREADYTOFAILOVERSLEEPSTATECHANGERECORDED
© Puget Sound Oracle Users GroupEducation Is Our Passion
Identifying Destination Settings
SQL> SELECT DEST_ID,VALID_TYPE,VALID_ROLE,VALID_NOW2 FROM V$ARCHIVE_DEST;
DEST_ID VALID_TYPE VALID_ROLE VALID_NOW------- --------------- ------------ --------------
1 ONLINE_LOGFILE ALL_ROLES YES2 STANDBY_LOGFILE STANDBY_ROLE YES3 ALL_LOGFILES ALL_ROLES UNKNOWN4 ALL_LOGFILES ALL_ROLES UNKNOWN5 ALL_LOGFILES ALL_ROLES UNKNOWN6 ALL_LOGFILES ALL_ROLES UNKNOWN7 ALL_LOGFILES ALL_ROLES UNKNOWN8 ALL_LOGFILES ALL_ROLES UNKNOWN9 ALL_LOGFILES ALL_ROLES UNKNOWN10 ALL_LOGFILES ALL_ROLES UNKNOWN11 ALL_LOGFILES ALL_ROLES YES
11 rows selected.
© Puget Sound Oracle Users GroupEducation Is Our Passion
© Puget Sound Oracle Users GroupEducation Is Our Passion
Closing Remarks