Oracle Dataguard

Oracle Dataguard Concepts:

Oracle dataguard consists of one Primary database which is production and one or more standby databases, connected with oracle net.

Primary Database:

Primary database is the one which serves as production.

Standby Database:

Standby databases are always in synch with the primary database and are ready to serve as production in any case where primary is unavailable. Standby databases are of three types:

  1. Physical Standby: Physical standby database is a block to block copy of primary database built using a dataguard service call Log Apply. Redo logs are transported to the Standby side and there standby redo logs are applied according to the recovery mechanism. This is the frequently used configuration of Oracle Dataguard.
  2. Logical Standby: Logical standby keeps the same logical information of data precisely as the primary database. Although the physical structure of the database may be different from primary because in this configuration the redo logs transported to the standby side are translated into SQL statements and then these SQL statements execute to build the data in the standby database. This process is called SQL APPY.
  3. Snapshot Standby: This is created by converting Physical Standby database in Snapshot standby database. This is a fully update- able standby database. In this configuration it does receive redo logs from the primary but these redo logs are not applied. Redo logs are applied only when the snapshot standby database is converted back to the physical standby database. And also when Snapshot standby is converted back to physical standby database then all the changes made to it while it was in snapshot standby state, are discarded. So this setup is mostly used for testing and development purposes without disturbing the production.

Dataguard Services:

  1. Redo Transport Services: This controls automated transfer of redo log files from primary database to any archival destination/s. Redo transport services perform following tasks:
    1. Manage transmission of data from primary to standby database/s.
    2. Manage process of resolving LOG_GAPS, i.e., gaps in the archived redo log files between the primary and the standby database.
    3. Redo transport services enforce protection modes.
    4. It verifies and replaces all the corrupt redo log files and missing ones, from the primary database or another standby database.
    5. It involves below background processes:
      1. ARCn: Archiver provcess
      2. LGWn: Log writer process.
      3. RFS: Remote file server process
      4. FAL: Fetch Archive Log process.
      5. MRP: Managed Recovery Process.
      6. LSP: Logical standby process.
  2. Log Apply Services: This service applies the redo data to the standby database to bring it in synch with the primary database. Log Apply services are categorised as below:
    1. REDO APPLY: Redo apply is done in case of physical standby databases.
    2. SQL APPLY: This is done in case of logical standby databases.
  3. Role Transition Services: In dataguard setup Oracle databases operate in two roles: Primary and standby. We can switch the roles of the databases using switchover or failover:
  • Switchover: One of the standby is converted into primary in case of any planned activity.
  • Failover: failover is done to switch standby to primary in case the primary is not available due to some failure.

Dataguard Broker: Dataguard broker is distributed management framework which can help us automate the creation, maintenance and monitoring of Oracle Dataguard configuration.

Dataguard Protection Modes:

  1. Maximum Protection: This is based on the transmission of redo log files. This protection mode ensures zero data loss so every transaction must be written to the online redo log files local and standby redo log files of at least one of the standby database which is transactionally consistent. In case due to some fault the redo stream is prevented to write data to the standby redo log file the database shuts down in max protection mode.
  2. Maximum Availability: This is based on the transmission of redo log files. It works exactly the same way Maximum protection mode does just the difference is that instead of shutting down in case of failure of redo stream being written to standby redo logs, it starts working in Maximum performance mode until the issue is resolved.
  3. Maximum Performance: This is the default Protection mode. This is based on transmission of archived redo log files. This protection mode provides maximum protection without compromising with the performance of the database. In this the commit is accepted as soon as the data is written to the local online redo log files.