查询real-time apply、real-time query的视图

real-time apply:就是备库USING CURRENT LOGFILE,对应视图V$ARCHIVE_DEST_STATUS.RECOVERY_MODE=MANAGED REAL TIME APPLY
real-time query:就是备库启到open read only模式,对应视图v$database.open_mode=READ ONLY WITH APPLY


real-time query
V$DATABASE.OPEN_MODE
READ ONLY WITH APPLY - A physical standby database is open in real-time query mode

SQL> alter database recover managed standby database disconnect from session;
Database altered.

SQL> select V$DATABASE.OPEN_MODE from V$DATABASE;
OPEN_MODE
--------------------
READ ONLY WITH APPLY




real-time apply
Use the ALTER DATABASE statement to enable the real-time apply feature, as follows:
For physical standby databases, issue the ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE statement.
SQL> alter database recover managed standby database using current logfile disconnect from session;

V$ARCHIVE_DEST_STATUS.RECOVERY_MODE
■ MANAGED - Managed recovery is active
■ MANAGED REAL TIME APPLY - Log apply services recover redo data from standby redo logs at the same time the logs are being written to,as opposed to recovering redo  from archived redo logs when a log switch occurs

SQL> alter database recover managed standby database disconnect from session;
Database altered.

SQL> select DEST_ID,DEST_NAME,RECOVERY_MODE from V$ARCHIVE_DEST_STATUS where dest_id<4;
   DEST_ID DEST_NAME RECOVERY_MODE
    1  LOG_ARCHIVE_DEST_1  MANAGED
    2  LOG_ARCHIVE_DEST_2  IDLE

SQL> alter database recover managed standby database cancel;
Database altered.

SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.

SQL> select DEST_ID,DEST_NAME,RECOVERY_MODE from V$ARCHIVE_DEST_STATUS where dest_id<4;
   DEST_ID DEST_NAME RECOVERY_MODE
    1 LOG_ARCHIVE_DEST_1 MANAGED REAL TIME APPLY
    2 LOG_ARCHIVE_DEST_2 IDLE



以下两个视图都不是查询是否real-time apply的视图
V$LOGSTDBY_STATE.REALTIME_APPLY
Y indicates that SQL Apply is running in real-time apply mode. If a standby redo log is configured, SQL Apply applies changes as they are written to the standby redo  log files.  N indicates that SQL Apply applies changes as each archived redo log file is received.

V$MANAGED_STANDBY.STATUS
APPLYING_LOG - Process is actively applying the archived redo log to the standby database


SQL> alter database recover managed standby database disconnect from session;
Database altered.

SQL> select V$MANAGED_STANDBY.STATUS from V$MANAGED_STANDBY;
STATUS
------------
CLOSING
CLOSING
CONNECTED
CLOSING
WAIT_FOR_LOG
IDLE
IDLE
IDLE

8 rows selected.

SQL> select status, sequence#, block# from v$managed_standby where client_process='LGWR';
STATUS        SEQUENCE#     BLOCK#
------------ ---------- ----------
IDLE                 60       1059

SQL> /
STATUS        SEQUENCE#     BLOCK#
------------ ---------- ----------
IDLE                 60       1061


SQL> select V$LOGSTDBY_STATE.REALTIME_APPLY from V$LOGSTDBY_STATE;
no rows selected

SQL> alter database recover managed standby database cancel;
Database altered.

SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.

SQL> select V$MANAGED_STANDBY.STATUS from V$MANAGED_STANDBY;
STATUS
------------
CLOSING
CLOSING
CONNECTED
CLOSING
APPLYING_LOG
IDLE
IDLE
IDLE

8 rows selected.

SQL> select V$LOGSTDBY_STATE.REALTIME_APPLY from V$LOGSTDBY_STATE;
no rows selected

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30126024/viewspace-2146013/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/30126024/viewspace-2146013/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值