Uzma Parveen 19c NF: DML ON STANDBY
19c NF- Active DataGuard DML Redirection
This new feature allows DML to be executed on an Active Data Guard standby database. When DML
(insert/update/delete) operation is executed the update is passed to the Primary database where it is
executed and the resulting redo of the transaction will update the Standby database after which control
will be returned to the application. The DML is executed preserving all ACID properties of the transaction.
Note: That some of the steps above could potentially introduce some performance overhead.
Requirement for enable DML Redirection:
• The managed standby recovery at the Active Data Guard standby database must be started with
the real-time apply option
• The Active Data Guard standby database must be in sync with the primary database.
• Connection to the Active Data Guard Standby database from a client machine or using a tns string
like '$ sqlplus sys@SUZMA19C as sysdba'
ENVIRONMENT
• Let us understand our environment.
PRIMARY STANDBY
OS / VERSION Oracle Linux Server 7.9 Oracle Linux Server 7.9
HOSTNAME [Link] [Link]
IP ADDRESS [Link] [Link]
DB NAME uzma19c uzma19c
DB UNIQUE NAME uzma19c suzma19c
DB ROLE PRIMARY PHYSICAL STANDBY
DB VERSION 19.3.0 19.3.0
Page 1 of 9 [Link]
Uzma Parveen 19c NF: DML ON STANDBY
Create Table on Primary and Insert 1 record
Connect to Standby and select the inserted record
Page 2 of 9 [Link]
Uzma Parveen 19c NF: DML ON STANDBY
Connect to Standby and try to Insert new record in to the table
When we try to perform the DML (insert) on standby we get ORA-1600 error.
Page 3 of 9 [Link]
Uzma Parveen 19c NF: DML ON STANDBY
On Standby Enable the Active DataGuard DML Redirection, then try to insert
To enable the DML on standby use below command:
• Alter session enable adg_redirect_dml
Or
• Alter system set ADG_REDIRECT_DML=TRUE
When we try to perform the DML (insert) on standby after DML enabling on standby but we still get
ORA-1600 error.
Page 4 of 9 [Link]
Uzma Parveen 19c NF: DML ON STANDBY
Start the MRP and then try to insert the new record
When we try to perform the DML (insert) on standby after starting the MRP this time we get ORA-16397
error
Page 5 of 9 [Link]
Uzma Parveen 19c NF: DML ON STANDBY
So finally, we followed below steps for succesful Active DataGuard DML Redirection
1. Connect to standby using TNS CONNECTION IDENTIFIER (sys@suzma19c as sysdba)
2. DB must be OPEN with MRP also running (READ ONLY WITH APPLY)
3. Enable adg_redirect_dml
And, this time record was inserted successfully on standby database.
Page 6 of 9 [Link]
Uzma Parveen 19c NF: DML ON STANDBY
How it works in background
When DML (insert) is done on standy, we do not get the SQL prompt until.
The DML goes to standby and Redo is generated.
The Redo generated is shipped and applied on standby and then we get the SQL prompt.
Page 7 of 9 [Link]
Uzma Parveen 19c NF: DML ON STANDBY
ORA-02055 and ORA-40509
If DML (Insert) done on Standby takes a lot of time to reach on primary then we will get ORA-02055 and
ORA-40509 error
ORA-40509 error can also be seen in Standby database alertlog.
Post ORA-02055 and ORA-40509 error we need to Rollback the DML on standby.
REF:
[Link]
workloads
Page 8 of 9 [Link]
Uzma Parveen 19c NF: DML ON STANDBY
THANKYOU!!!
Page 9 of 9 [Link]