physical standby 实时应用(rac)

实时应用这种方式必须Standby Redo Log,每当日志被写入Standby Redo Log时,就会触发恢复,使用这种方式的好处在与可以减少数据库切换(Switchover 或者Failover)的时间,因为切换时间主要用在剩余日志的恢复上。 

为每个thread添加3个standby日志组:

SQL> alter database add standby logfile thread 1

  2  group 5 ('/soft/oradata/standby/stanredo_1_1.log') size 50M,
  3  group 6 ('/soft/oradata/standby/stanredo_1_2.log') size 50M,
  4  group 7 ('/soft/oradata/standby/stanredo_1_4.log') size 50M;

Database altered.

SQL> alter database add standby logfile thread 2
  2  group 8 ('/soft/oradata/standby/stanredo_2_1.log') size 50M,
  3  group 9 ('/soft/oradata/standby/stanredo_2_2.log') size 50M,
  4  group 10 ('/soft/oradata/standby/stanredo_2_3.log') size 50M;

Database altered.


启用实施应用:(这种方式在Primary Database发生日志切换,触发Standby Database 归档操作,归档完成后触发恢复。 这也是默认的恢复方式。)

SQL> alter database recover managed standby database using current logfile;

用using current logfile 就可以启用实时应用了,但是以上语句执行之后不会有任何反馈,不会出现Database altered

要有所反馈应disconnect from session。

例如

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


查看应用模式:

SQL> Select recovery_mode from v$archive_dest_status;
RECOVERY_MODE
---------------------------------------------------------------------
MANAGED REAL TIME APPLY
MANAGED REAL TIME APPLY
MANAGED REAL TIME APPLY
MANAGED REAL TIME APPLY
MANAGED REAL TIME APPLY
MANAGED REAL TIME APPLY
MANAGED REAL TIME APPLY
MANAGED REAL TIME APPLY
MANAGED REAL TIME APPLY
MANAGED REAL TIME APPLY
MANAGED REAL TIME APPLY
11 rows selected.


切换为归档时应用:

首先要停应用:

SQL> Alter database recover managed standby database cancel;

否则会报错!

SQL> Alter database recover managed standby database disconnect from session;
Alter database recover managed standby database disconnect from session
*
ERROR at line 1:
ORA-01153: an incompatible media recovery is active

再开启归档时应用:

SQL> Alter database recover managed standby disconnect from session;

产看此时的应用模式:

SQL> Select recovery_mode from v$archive_dest_status;
RECOVERY_MODE
---------------------------------------------------------------------
MANAGED
MANAGED
MANAGED
MANAGED
MANAGED
MANAGED
MANAGED
MANAGED
MANAGED
MANAGED
MANAGED
11 rows selected.


查看应用进程:

SQL> SELECT PROCESS, STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS FROM V$MANAGED_STANDBY order by 1;

PROCESS                     STATUS                                  THREAD#  SEQUENCE#     BLOCK#     BLOCKS
--------------------------- ------------------------------------ ---------- ---------- ---------- ----------
ARCH                        CONNECTED                                     0          0          0          0
ARCH                        CONNECTED                                     0          0          0          0
ARCH                        CONNECTED                                     0          0          0          0
ARCH                        CONNECTED                                     0          0          0          0
MRP0                        WAIT_FOR_LOG                                  1         64          0          0
RFS                         IDLE                                          2         73        219          1
RFS                         IDLE                                          0          0          0          0
RFS                         IDLE                                          0          0          0          0
RFS                         IDLE                                          0          0          0          0
RFS                         IDLE                                          0          0          0          0
RFS                         IDLE                                          1         64      56637          1
RFS                         IDLE                                          0          0          0          0

12 rows selected.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值