Oracle 11g dataguard check real time apply

时间:2021-02-12 03:46:25

2017年8月24日

16:38

环境:oracle 11.2.0.1 OEL-5.8

注:以下操作都在备库执行

总结方法:

1、FPYJ(125_7)@fpyj123> select open_mode from v$database;

OPEN_MODE

--------------------

READ ONLY WITH APPLY                   --证明开启 RTA

2、FPYJ(125_7)@fpyj123> select DEST_ID,DEST_NAME,RECOVERY_MODE from v$archive_dest_status where RECOVERY_MODE <>'IDLE';

DEST_ID DEST_NAME    RECOVERY_MODE

---------- -------------------------------------------------------------------------------------------------------------------------------------------        1 LOG_ARCHIVE_DEST_1     MANAGED    --RECOVERY_MODE为MANAGED REAL TIME APPLY               --证明开启了 RTA

 

请确认以下参数:

FPYJ(125_7)@fpyj123> col value for a100

FPYJ(125_7)@fpyj123> col name for a20

FPYJ(125_7)@fpyj123> select name,value from v$parameter where name in ('log_archive_dest_1','log_archive_dest_2');

NAME                 VALUE

-------------------- ----------------------------------------------------------------------------------------------------

log_archive_dest_1   location=/home/oracle/arch_dir/fpyj123 valid_for=(all_logfiles,all_roles) db_unique_name=fpyj123

log_archive_dest_2   service=fpyj sync lgwr valid_for=(all_logfiles,all_role) db_unique_name=fpyj

log_archive_dest_1  配置如下:VALID_FOR  一定是 all_logfiles,all_roles 不然无法 RTA

FPYJ(125_7)@fpyj> alter system set log_archive_dest_1='LOCATION=/home/oracle/arch_dir/fpyj VALID_FOR=(all_logfiles,all_roles) db_unique_name=fpyj' scope=spfile;

未开启real time apply ,以下操作打开的备库的RTA

SYS(139_22)@fpyj123>  select open_mode from v$database;

OPEN_MODE

--------------------

READ ONLY

SYS(139_22)@fpyj123>  select process,client_process,status,thread#,sequence#,block#,blocks from v$managed_standby;

PROCESS   CLIENT_P STATUS          THREAD#  SEQUENCE#     BLOCK#     BLOCKS

--------- -------- ------------ ---------- ---------- ---------- ----------

ARCH      ARCH     CONNECTED             0          0          0          0

ARCH      ARCH     CONNECTED             0          0          0          0

ARCH      ARCH     CONNECTED             0          0          0          0

ARCH      ARCH     CLOSING               1         63          1        421

RFS       N/A      IDLE                  0          0          0          0

RFS       LGWR     IDLE                  1         64        123          1

RFS       UNKNOWN  IDLE                  0          0          0          0

--没有MRP0 进程哦,不能RTA

开启real time apply

物理DG开启RTA命令如下:

SYS(139_22)@fpyj123> alter database recover managed standby database using current logfile disconnect from session;

Database altered.

再次检查MRP进程

SYS(139_22)@fpyj123> select process,client_process,status,thread#,sequence#,block#,blocks from v$managed_standby;

PROCESS   CLIENT_P STATUS          THREAD#  SEQUENCE#     BLOCK#     BLOCKS

--------- -------- ------------ ---------- ---------- ---------- ----------

ARCH      ARCH     CONNECTED             0          0          0          0

ARCH      ARCH     CONNECTED             0          0          0          0

ARCH      ARCH     CONNECTED             0          0          0          0

ARCH      ARCH     CLOSING               1         63          1        421

RFS       N/A      IDLE                  0          0          0          0

RFS       LGWR     IDLE                  1         64        221          1

RFS       UNKNOWN  IDLE                  0          0          0          0

MRP0      N/A      APPLYING_LOG          1         64        221     102400

--redo apply情况

SQL> select open_mode from v$database;

OPEN_MODE

--------------------

READ ONLY WITH APPLY

 

SYS(139_22)@fpyj123> col DEST_NAME for a20

SYS(139_22)@fpyj123> set linesize 1000

SYS(139_22)@fpyj123> set pagesize 1000

col dest_name for a20

SQL> select DEST_ID,DEST_NAME,RECOVERY_MODE from v$archive_dest_status where recovery_mode not like 'IDLE' ;

DEST_ID DEST_NAME            RECOVERY_MODE

---------- -------------------- -----------------------

         1 LOG_ARCHIVE_DEST_1   MANAGED REAL TIME APPLY

 

红色部分证明standby database 开启了real time apply