What is real time apply in dataguard?
If media recovery is started with the following command after installing Data Guard in versions prior to Oracle 12c, Media Recovery starts as Archived Log Apply and not Real Time Apply. This means that the transactions coming from the Primary side will be processed to the Standby side immediately after the Standby Archive Logs are created. This situation has a side effect as follows; In the case of switchover or failover, unprocessed archives need to be processed to open the instance. This means that the failover/switchover will slow down.
1 |
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT; |
Enable Real Time Apply in Dataguard
Check real time apply is enabled on standby database
(Standby 1)
1 2 3 4 5 |
SQL> select DATABASE_MODE, RECOVERY_MODE, PROTECTION_MODE from v$archive_dest_status; DATABASE_MODE RECOVERY_MODE PROTECTION_MODE --------------- ----------------------- -------------------- MOUNTED-STANDBY MANAGED MAXIMUM PERFORMANCE |
Enable Real Time Apply
(Standby 1)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL; Database altered. Tue Jan 03 10:32:36 2017 ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL Tue Jan 03 10:32:37 2017 MRP0: Background Media Recovery cancelled with status 16037 Errors in file /u01/app/oracle/diag/rdbms/standby/primary1/trace/primary1_pr00_23147.trc: ORA-16037: user requested cancel of managed recovery operation Recovery interrupted! Tue Jan 03 10:32:37 2017 MRP0: Background Media Recovery process shutdown (primary1) Managed Standby Recovery Canceled (primary1) Completed: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT; Database altered. Tue Jan 03 10:33:49 2017 (Standby 1) ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT Attempt to start background Managed Standby Recovery process (primary1) Tue Jan 03 10:33:49 2017 MRP0 started with pid=54, OS id=24358 MRP0: Background Managed Standby Recovery process started (primary1) started logmerger process Tue Jan 03 10:33:55 2017 Managed Standby Recovery starting Real Time Apply Parallel Media Recovery started with 4 slaves Waiting for all non-current ORLs to be archived... All non-current ORLs have been archived. Tue Jan 03 10:33:55 2017 Media Recovery Waiting for thread 2 sequence 33 (in transit) Recovery of Online Redo Log: Thread 2 Group 9 Seq 33 Reading mem 0 Mem# 0: +DATA/standby/onlinelog/group_9.271.932283685 Mem# 1: +FRA/standby/onlinelog/group_9.264.932283685 Completed: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT Media Recovery Log +FRA/standby/archivelog/2017_01_03/thread_1_seq_65.349.932293653 Media Recovery Waiting for thread 1 sequence 66 (in transit) Recovery of Online Redo Log: Thread 1 Group 6 Seq 66 Reading mem 0 Mem# 0: +DATA/standby/onlinelog/group_6.268.932283683 Mem# 1: +FRA/standby/onlinelog/group_6.261.932283683 Tue Jan 03 10:33:54 2017 (Standby 1) Managed Standby Recovery starting Real Time Apply |
Check real time apply is enabled on standby database
(Standby 1)
1 2 3 4 5 |
SQL> select DATABASE_MODE, RECOVERY_MODE, PROTECTION_MODE from v$archive_dest_status; DATABASE_MODE RECOVERY_MODE PROTECTION_MODE --------------- ----------------------- -------------------- MOUNTED-STANDBY MANAGED REAL TIME APPLY MAXIMUM PERFORMANCE |
Check if there is Apply Lag
(Standby 1)
1 2 3 4 5 6 7 8 9 |
SQL> column value format a20 SQL> select name, value from v$dataguard_stats; NAME VALUE -------------------------------- -------------------- transport lag +00 00:00:00 apply lag +00 00:00:00 apply finish time +00 00:00:00.000 estimated startup time 28 |