Data Guard is Oracle’s High Availability Disaster Management solution. Disaster management in terms of protecting from Human errors, Natural disasters etc.
Data Guard configuration consists of at least two databases: Primary and Standby (one or more).
A primary database used to create standby database which in turns can be seen as a consistent copy of primary database and can become primary db in case of planned, unplanned downtime or non-availability of primary database. The database in an Oracle DG configuration can be located on the same server or they can be at remote locations connected through WAN.
With the Oracle DB 11g Release 2, a data guard configuration can support up to 30 Standby databases.
Standby Database Types
Physical standby is identical copy (block by block) of a primary database. Physical standbys are updated by applying redo changes (REDO Apply) that transported from primary to standby using ARCH or LGWR process.
A Logical standby can be seen as a subset of primary database. In other words, the structure of objects in logical standby can be different from primary database. Logical standbys are kept synchronized with the primary through SQL apply, transforming archived logs into SQL statements and applied them on the standby database.
Contrary to physical standby which is an identical copy of primary database and support all the data types, logical standby does not supports all data types and objects
Snapshot standby is introduced in the Oracle 11g. It can be seen as extension to physical standby. It receives and archives redo data from the primary (like the other two mentioned above), but does not apply them. It basically converts a physical standby to read-write mode so that some testing can be done and when the snapshot standby is converted back to the physical standby, first all the changes made during the snapshot mode will be discarded and the redo data received by the database will be applied afterward.
During the time when database is in read-write (snapshot) mode no logs are applied.
Data Guard operates in three different protection modes:
Default protection mode with the primary concern on the performance. In this mode, transaction commits as soon as redo data written to the local redo logs. It provides less data protection compared to other modes.
Highest level of data protection while the primary database is available. Transaction commits, when redo written to the local redo logs and at least one standby location. In case of no standby location is available, the primary doesn’t shut down and continue to generate redo entries.
No (Zero) data loss. Redo entries must be written to the local online redo logs and at least one standby location before a transaction commits on primary. Primary will shut down if it can’t write redo to the standby database.
Switch-over is planned role changes between primary and standby databases usually to allow maintenance activities to be performed on primary.
On the other hand, Fail-over occurs in the event of taking the primary database offline (can be because of unplanned failure). In this case one of the standbys becomes new primary and original primary may need to be rebuilt.
The main difference between switchover and failover is primary database is still available in the case of switchover.
Tools to administering Data Guard configurations
- SQL* Plus command line
- Enterprise Manager
- Data Guard Broker command-line (DGMGRL)