DG Real-Time Apply是否实时

2018-06-26

实时应用日志是11g物理dataguard的特性, Real-Time Apply ,也叫adg

##################
查看DG是否是实时应用
1、select DEST_NAME , STATUS , RECOVERY_MODE from v$archive_dest_status;
不管是主库还是备库:
recover_mode:
是MANAGED REAL TIME APPLY是实时应用;
是MANAGED是非实时应用。

2、查看物理备库日志进程的状态:
SQL> SELECT PROCESS, STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS FROM V$MANAGED_STANDBY;
总结:从 v$managed_standby看,
备库MRP进程STATUS是 APPLYING_LOG 是实时应用,
或者主库LNS 进程是WRITING是实时引用;

备库MRP进程STATUS是 WAIT_FOR_LOG 是非实时应用,
或者主库LGWR 或者归档 进程是WRITING是非实时引用;(实时应用是用LNS进程发送日志,非实时应用是用LGWR或者ARCH进程发送日志)

3、如何修改备库为实时应用?实时日志应用(real-time apply )

To start real-time apply, include the USING CURRENT LOGFILE clause on the SQL statement. For example:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE;
a)ORA-01153: an incompatible media recovery is active
仔细检查发现上面已经执行过一次
alter database recover managed standby database disconnect from session;
猜想应该是重复启用日志应用所致。故取消应用
alter database recover managed standby database cancel;

b)ORA-00283: recovery session canceled due to errors
ORA-12801: error signaled in parallel query server P003
ORA-00600: internal error code, arguments: [3020], [2], [28878], [8417486], [],
[], [], []
ORA-10567: Redo is inconsistent(不一致的) with data block (file#
是redo与数据库不一致造成的

物理standby实时应用日志:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE
逻辑standby 实时应用日志:
ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE

Real-time apply requires a standby database that is configured with a standby redo log and that is in ARCHIVELOG mode.
LOG_ARCHIVE_DEST_n initialization parameter to delay applying archived redo log files to the standby database.
By default, there is no time delay. If you specify the DELAY attribute without specifying a value, then the default delay interval is 30 minutes.

4、需要停止实时日志应用,按照非实时模式启动MRP,比如:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
物理standby停止实时应用日志:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE NODELAY;
逻辑standby停止实时应用日志:
SQL> ALTER DATABASE START LOGICAL STANDBY APPLY NODELAY;

5、为了设置延搜索时Apply,需要在log_archive_dest_n 参数上使用“DELAY=",比如:DELAY=360(单位为分钟),表示延时360分钟(6小时)。比如:alter system set log_archive_dest_2='SERVICE=standby LGWR SYNC AFFIRM DELAY=360VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) COMPRESSION=ENABLE DB_UNIQUE_NAME=standby';
6、SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
( 什么时候应该运行?主的出问题的时候。)
You can specify that Redo Apply runs as a foreground session or as a background process, and enable it with real-time apply.
■ To start Redo Apply in the foreground, issue the following SQL statement:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE;
If you start a foreground session, control is not returned to the command prompt until recovery is canceled by another session.

■ To start Redo Apply in the background, include the DISCONNECT keyword on the
SQL statement. For example:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;
This statement starts a detached server process and immediately returns control to the user. While the managed recovery process is performing recovery in the
background, the foreground process that issued the RECOVER statement can continue performing other tasks. This does not disconnect the current SQL session.

■ To start real-time apply, include the USING CURRENT LOGFILE clause on the SQL statement. For example:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE;

分类:数据库 | 标签: |

相关日志

评论被关闭!