Read replicas in Oracle on premise — Oracle ADG with DML re-direct

With the introduction of distributed databases came the concept of replicas. Cloud popularized it more and more …. this further lead to some request for replicas on premise systems as well (called as Oracle Data Replication). Objective was to offload the reporting and optional applications from the primary database server. We went through a few possible options —

and in this post we’ll talk about Oracle Active Data Guard with DML re-direct (wherein you can have replicas which support ad-hoc write requests as well).

What is Oracle data guard?
Oracle Data guard is an extension of Oracle RDBMS which aids in maintaining secondary standby databases as supplementary repositories to primary datastores. Data Guard supports two types of standbys — physical standby (redo apply) and logical standby (sql apply) sites.

Limitations of Oracle Data guard (Why Oracle active data guard)
Data guard cannot be used as a read replica because if you want it open read-only, you must pause the sync process (debatable).
To overcome this limitation Oracle came up with Active Data Guard. With ADG we could open the Standby Database in read-only mode while Oracle replicated the redo from the master. This helped the architecture in -
> Reducing the load on the primary
> Ensuring that the load on the primary is consistent
> Enhanced utilization of the standby resources

What is Oracle active data guard?
Oracle Active Data Guard is an extension to Data guard. Though it’s main purpose is to prevent data loss and avoid downtime it can also be used as a physical replica to offload the traffic from the primary for purposes such as reporting.
Note that Oracle ADG has an additional license cost to it. It allows read-only access on the physical standby node at the same time as applying archived transactions from the primary node. It prevents data loss and downtime in the simplest and most economical manner by maintaining a synchronized physical replica of a production database at a remote location. If the production database is unavailable for any reason, client connections can quickly, and in some configurations transparently, failover to the synchronized replica to restore service.

Limitations of Active Data guard
The biggest problem with the read replica is that sometime read heavy applications still need to write or update a small table. Say Reporting tools often need to log if a report has failed or how much time it took. And the problem was not obvious- For example, even simple SQL such as <sequence>.nextval is not supported as this requires a dictionary update.
Prior to Oracle 19c we would create a DB links and that would solve the issue. Though that is also not without it’s own set of problems (say db links require production password).
Refer for more details — Using Active Data Guard Reporting with Oracle E-Business Suite Release 12.2 and an Oracle 11g or 12c Database (Doc ID 1944539.1)

What is ADG DML re-direction?
With Oracle 19c ADG comes with a DML re-direct feature making life happier. DML enables the Data Manipulation Language (DML) operations on the standby server to be redirected and run on the production (Primary) database.
The DML Redirection process can be broken down into 5 steps:
> Client issues a DML on the Standby
> Standby captures the DML and pushes it to the primary database using an internal db-link
> Primary executes the DML (which generates redo)
> This redo is a normal redo stream and together with the normal redo stream this is sent to the standby database
> Standby database applies the received redo stream and releases the lock on the session so the session can see the result.

Voila you have limited write replica available (keep in mind that writes through standby are slower)

What is the cost of Active Data Guard?
Active Data Guard carries a list price of $11,500 USD, and both the primary and standby databases must be licensed if they reside on different physical servers.

Pending (Performance statistics for sharing load between Primary and Secondary)




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to become a speaker for event series- Kotlin/Everywhere Journey

Multi-Cloud Setup of Kubernetes

Combining Math and Law in Python

Improving mobile web conversions just by optimizing web forms

Ready-To-Customise File Manager Dashboard — HOPE UI | Iqonic Design

Sugui Digest. SE01EP09 — Changes.

Import Wordpress Users into Firebase Authentication

The programming’s gateway

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Manas Yadav

Manas Yadav

More from Medium

C# Task Cancellation with Blocking Method Call

Post auth RCE based in malicious LUA plugin script upload SCADA controllers located in Russia

Tracing Application Interactions with CockroachDB

Ansible — JSON_QUERY Nested KeyValuePair