Beclever blog

Our latest news

Oracle data guard


In this blog we will talk about the basic concepts of Oracle Data Guard in a schematic way that helps us to properly understand the architecture and operation of Oracle Data Guard as a replication solution for Oracle DB.


  • Oracle data guard is one replication solution for Oracle DB.
  • Oracle-oracle replication.
  • Free with Oracle Enterprise license.
    • It is mandatory to have the DB license.
  • Oracle Data Guard provides High Availability, Disaster Recovery and Data protection.
  • Based on a main DB, it is possible to have 30 DB standby
    • The standby Db may be in LAN or WAN
  • Oracle Data Guard Broker is a framework to the Data Guard management, to manage, maintain and monitor the Data Guard configurations, via Oracle Enterprise Manager or Data Guard command-line interface (DGMGRL).





  • Main DB:
    • It is the main Db, which will assume the main role, giving service to the applications.
    • It may be single-instance or RAC
  • Standby DB:
    • It is a main Db copy transactional consistent.
    • Based on the main DB backup it may be till 30 DB on standby and add them to the Oracle Data Guard configuration. Once the configuration is created, Oracle Data Guard automatically will maintain each standby DB transmitting and applying the generated redo in the main DB to the standby DBs.
    • The standby DB may be single-instance or RAC.
  • Far sync instances
    • Remote target of Oracle Data Guard that accepts the main DB redo and sends the redo to other Data Guard configuration members.
    • Far sync instance, manages a control file that receives the redo on the Standby Redo logs (SRLs) and archives them on local archived redo logs. There are no user data files, it cannot be opened for access, it cannot execute redo apply and never will work with a main role or be converted to any kind of standby database (physical or logical).
  • Zero Data Loss Recovery Appliance
    • Backup business solution that offers a unique repository or DB backups.

Standby DB types

  • Physical standby database
    • Offers an identic copy of the main DB, where the DB structures on a disk level are the same as in the block level. The schemes of the DB, including indexes, are the same.
    • It maintains synchronized the main DB using Redo Apply
    • We may open the read-only mode, although we will have to stop replication.
    • If Active Data Guard is licensed, a physical standby database may receive and apply redo when it is open in read-only mode.
  • oracle-data-guard-2
  • Logical standby database
    • Contains the same logical information as de primary DB, where the physical organization and data structure may be different.
    • Stays synchronized with the primary DB by using SQL apply technology.
    • SQL Apply transforms the information received by the redos in SQL sentences applied to the standby DB.
    • The DB may be opened on read/write mode, although the tables may be managed with Data Guard it must be in read only.
    • There doesn’t exit Data Guard for logical standby DB.

It has no sense because the DB is opened by

  • Snapshot Standby Database
    • A Snapshot Standby DB is a standby database that may be fully updated.
    • As a physical or logical standby DB, a snapshot standby DB receives and archived the primary DB redo.
    • Unlike a physical or logical standby DB, a snapshot standby database does not apply the received redo.
      • To apply it, the snapshot standby database should be converted to physical standby DB, although first the local updated should be discarded.
    • A standby snapshot database is often used in scenarios that require an updateable temporary snapshot of the physical standby DB.

Protection types

  • Maximum Availability
    • Maximum guarantee of data protection without compromising availability.
    • The transactions will be committed when both options (configurable) are fulfilled on at least on of the standby DB.
      • Has been received on memory.
      • Has been written on SRL (standby redo log),
    • If the redo stream cannot be sent, it will act as in the Maximum performance mode to preserve the availability till the sending of the redo is recovered.
    • LGWR processes will be used.
  • Maximum performance
    • Maximum data protection guarantees without performance compromise.
    • The transactions will be committed when the online redo log has been written.
    • The redo also is written on the standby DB but on asynchronous mode.
    • LGWR or ARCn processes may be used.
  • Maximum protection
    • There will NOT be data lose in case the primary DB fails.
    • The transactions will be committed when either the online redo log or SRL (standby redo log) transactions have been written.
    • If the stream redo cannot be sent the primary DB will be stopped.
    • LGWR will be used.

Services: Redo transmission management

  • Redo Transport Services
    • Manages the automatically redo sending from the primary DB to the standby.
  • Apply services
    • The redo is applied to the target using:
      • Redo apply for physical standby DB.
      • SQL apply for logical standby DB.
    • If the real-time apply is active, the redo will apply directly from the SRL (standby redo log) when it is filling up.
    • If SRL is not configured the redo must be archived on the standby DB before it is applied.
  • Role Transactions
    • Changes the role of a standby DB o primary, or primary to standby (making a switchover or failover).

Redo transport service

  • Done tasks:
    • Transfer the redo from primary to standby DB.
    • Manage the gap resolution process on the archived redo log files due to network problems.
    • Detect automatically the archived redo log lost or corrupted files on the standby DB and automatically send them from the primary or other standby.
  • Redo sending modes:
    • Archiver processes (ARCn)
    • Log writer process (LGWR)oracle-data-guard-4



Redo transport service: using archiver processes (ARCN)

  • For maximum performance mode where the redo sending is asynchronous.
  • Archiving occurs with a log switch, where first the ARC0 process archives the local Online Redo Log to a local Archived Redo Log, and then ARC1 transmits the redo from the local archived redo log to the




Redo transport service: using log writer process (LGWR)

  • There may be used three modes; maximum performance, maximum protection and maximum availability.
  • When using LGWR for replication, there is no waiting for a redo log switch (as there was in the Archiver Processes based mode), but the LGWR process selects an SRL (standby redo log) at the standby site that reflects the sequence number (and size) of the current online redo log of the primary DB. As soon as the redo is generated at the primary, it is also sent to the standby.
  • Submission to the secondary site, maybe:
    • Synchronous for a maximum protection or maximum availability protection mode.
    • Asynchronous for a maximum performance protection mode.

Synchronous mode

oracle-data-guard-6Asynchronous mode




Log apply service

  • Automatically apply the redo on the standby DB to maintain synchronization with the primary.
  • By default, you wait for the full redo log file to arrive before applying it.
  • In case of using the Standby Redo Log (SRL), the Real-Time Apply can be enabled, which allows the application of the redo as it is received.
  • Application methods:
    • Redo Apply (only for physical standby databases): uses media recovery to keep primary and standby synchronized.
    • SQL Apply (only for logical standby databases): constructs SQL sentences from the received redo and executes them against the para logical standby database.

Log apply service: redo apply

  • Used to apply the redo in a physical standby database.
  • Uses media recovery to keep primary and standby in sync.
  • By default, you wait for the full redo log file to arrive before applying it.
  • You can enable the Real-Time Apply, which allows you to apply the redo as it is received.
    • In this case, the database will not be open for reporting (in read-only mode), unless Active Data Guard is licensed.
  • A delay can be set to apply the data.
    • This delay is set in minutes and starts your count from the arrival of the full redo.

Log apply service: SQL apply

  • Used to apply the redo in a physical standby database.
  • Builds SQL sentences from the received redo and executes them against the para logical standby database.
  • By default, you wait for the full redo log file to arrive before applying it.
  • You can enable the Real-Time Apply, which allows you to apply the redo as it is received.
  • The logical standby database is open, so it can be used like a normal DB:
    • We can have the DB in Read/Write, but the tables maintained with Data Guard must be in Read Only.
  • An Oracle DB can operate in one of two roles: primary or standby.
  • Using Oracle Data Guard, you can change the role of a DB:
    • Switchover:
      • It is the change of role between a primary and one of its standby DB, where the primary changes to standby and vice versa.
      • Ensures no data is lost.
    • Failover:
      • It occurs when the primary is not available.
      • In the event of unavailability of the primary school, one of the standbys will take on the primary role.
      • Depending on the Data Guard configuration, there may or may not be data loss.

Benefit resume

  • Disaster Recovery, Data Protection and High Availability.
  • Complete data protection, including data corruption.
  • Efficient use of resources.
    • You could use the standby DB for backups, reporting, etc.
  • Flexibility in data protection to balance availability with performance.
    • Maximum protection, maximum availability, and maximum performance modes.
  • Automatic gap detection and resolution.
    • In case of loss of visibility between primary and standby, a gap is created, which is automatically resolved when visibility is restored.
  • Easy and centralized management via Oracle Data Guard broker (graphical interface and via command line).
  • Integration with Oracle Database.
  • Automatic Role Transition.

Leave a comment