Multi-Instance Redo Apply (MIRA) in Oracle RAC
In Oracle 11g, when Data Guard was implemented in a cluster, only the node where the command ALTER DATABASE MANAGE RECOVER
was executed (for the first time!) was responsible for applying the redo logs. The remaining nodes could be used for reporting, backup, receiving redo (or archive), and other purposes.
In Oracle 12cR2, an improvement was introduced that allows all nodes to participate in recovery. This feature, called Multi Instance Redo Apply (MIRA), makes it possible to apply redo logs using multiple instances.
To enable this feature, you can add the clause [INSTANCES [ ALL | integer ]]
to the ALTER DATABASE RECOVER MANAGED STANDBY DATABASE
command:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE INSTANCES [ ALL | integer]
For example, with the following command in a test environment containing only two nodes, both nodes will share the redo apply task:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE INSTANCES ALL disconnect;
By checking the alert log on the node where the command was executed, you will see the following messages:
Started logmerger process on instance id 2
Started logmerger process on instance id 1
Starting Multi Instance Redo Apply (MIRA) on 2 instances
2018-09-02T15:30:27.514112+04:30
Starting Multi Instance Redo Apply (MIRA)
2018-09-02T15:30:27.562984+04:30
…. (PID:15215): Managed Standby Recovery starting Real Time Apply
2018-09-02T15:30:27.861206+04:30
Started 16 apply slaves on instance id 2
2018-09-02T15:30:28.117260+04:30
Started 16 apply slaves on instance id 1
2018-09-02T15:30:28.643222+04:30
Also, by executing this command on the second instance, only that node will run the MRP process:
–node 1:
[root@db~]# ps -eaf|grep mrp
–node 2:
[root@db~]# ps -eaf|grep mrp
oracle 17458 1 0 14:40 ? 00:00:00 ora_mrp0_stb2
In this case, the MRP process acts as a coordinator between processes that start with the prefix parallel recovery slave process (pr). Based on the alert log messages, 16 pr
processes are started on each node:
Started 16 apply slaves on instance id 2
2018-09-02T15:30:28.117260+04:30
Started 16 apply slaves on instance id 1
[root@db~]# ps -eaf|grep pr
oracle 16487 1 0 15:30 ? 00:00:00 ora_pr02_stb2
If recovery is canceled on any of the nodes, media recovery will be completely terminated:
–node 2:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE INSTANCES ALL disconnect;
Database altered.
–node 1:
SQL> alter database recover managed standby database cancel;
Database altered.
–node 2:
ORA-16037: user requested cancel of managed recovery operation
2018-09-02T14:48:52.719683+04:30
Background Media Recovery process shutdown (stb2)
To use the MIRA feature, all instances must be in the same state (open or mount). Otherwise, you will encounter the following error:
Starting Multi Instance Redo Apply (MIRA)
2018-09-02T14:39:31.422046+04:30
…. (PID:15215): Managed Standby Recovery starting Real Time Apply
2018-09-02T14:39:31.426539+04:30
Multi Instance Redo Apply terminaed with error 10459
2018-09-02T14:39:31.432166+04:30
Errors in file /oracle/diag/rdbms/stb/stb2/trace/stb2_pr00_16780.trc:
ORA-10459: cannot start media recovery on standby database; conflicting state detected
MIRA: Mark controlfile recovery error occurred
Written by Vahid Yousefzadeh
I have been a DBA since 2011 and I work with Oracle technology. Linkdin: linkedin.com/in/vahidusefzadeh telegram channel ID:@oracledb vahidusefzadeh@gmail.com
Comments
Post a Comment