大鲨鱼o0O

保持理智,冷静分析,懂得择决,默默前行

深厚的内功远远大于精妙的招式


oracle RTA

PS:这些DG实现都是建立在我之前DG博客的基础上的

此时备库是mount状态

19:53:38 SYS @ gotime >select status from v$instance;

STATUS
------------
MOUNTED

1 row selected.

Elapsed: 00:00:00.01

备库打开至open,然后设置成RTA模式

20:10:00 SYS @ gotime >alter database open;

Database altered.

Elapsed: 00:00:00.33
20:10:09 SYS @ gotime >select status from v$instance;

STATUS
------------
OPEN

1 row selected.

Elapsed: 00:00:00.01
20:10:23 SYS @ gotime >select name,open_mode,database_role,protection_mode from v$database;

NAME     OPEN_MODE     DATABASE_ROLE    PROTECTION_MODE
--------- -------------------- ---------------- --------------------
SLOW     READ ONLY     PHYSICAL STANDBY MAXIMUM AVAILABILITY

1 row selected.

Elapsed: 00:00:00.01
20:11:02 SYS @ gotime >recover managed standby database using current logfile disconnect;
Media recovery complete.

此时备库的告警日志信息

Serial Media Recovery started
Managed Standby Recovery starting Real Time Apply
Waiting for all non-current ORLs to be archived...
All non-current ORLs have been archived.
Media Recovery Waiting for thread 1 sequence 35 (in transit)
Recovery of Online Redo Log: Thread 1 Group 4 Seq 35 Reading mem 0
  Mem# 0: /u01/app/oracle/oradata/gotime/standby04.log
Completed: ALTER DATABASE RECOVER managed standby database using current logfile disconnect

主库上开始一些DML操作并提交,测试是否成功,备库能否能够在提交瞬间作出反应,立即同步呢??

20:13:05 SYS @ slow >select * from t2017;

    DEPTNO DNAME     LOC
---------- -------------- -------------
    10 ACCOUNTING     NEW YORK
    20 RESEARCH     DALLAS
    30 SALES     CHICAGO
    40 OPERATIONS     BOSTON
    10 ACCOUNTING     NEW YORK
    20 RESEARCH     DALLAS
    30 SALES     CHICAGO
    40 OPERATIONS     BOSTON

8 rows selected.

Elapsed: 00:00:00.00
20:13:21 SYS @ slow >create table t2018 as select * from t2017 where deptno < 30;

Table created.

Elapsed: 00:00:00.03
20:14:58 SYS @ slow >commit;

Commit complete.

Elapsed: 00:00:00.00
20:15:02 SYS @ slow >

答案是确定的,说明成功了,备库能对主库commit的DML操作立即同步,做出反应!!!

20:14:16 SYS @ gotime >select * from t2017;

    DEPTNO DNAME     LOC
---------- -------------- -------------
    10 ACCOUNTING     NEW YORK
    20 RESEARCH     DALLAS
    30 SALES     CHICAGO
    40 OPERATIONS     BOSTON
    10 ACCOUNTING     NEW YORK
    20 RESEARCH     DALLAS
    30 SALES     CHICAGO
    40 OPERATIONS     BOSTON

8 rows selected.

Elapsed: 00:00:00.10
20:15:17 SYS @ gotime >select * from t2018;

    DEPTNO DNAME     LOC
---------- -------------- -------------
    10 ACCOUNTING     NEW YORK
    20 RESEARCH     DALLAS
    10 ACCOUNTING     NEW YORK
    20 RESEARCH     DALLAS

4 rows selected.

Elapsed: 00:00:00.00
20:15:36 SYS @ gotime >

备库重新启动之后,Real Time Apply 消失

将备库由Real Time Apply 状态重新启动,然后打开至open,进行测试

20:15:36 SYS @ gotime >startup mount force
ORACLE instance started.

Total System Global Area 521936896 bytes
Fixed Size         2254824 bytes
Variable Size         377489432 bytes
Database Buffers     138412032 bytes
Redo Buffers         3780608 bytes
Database mounted.
20:24:30 SYS @ gotime >recover managed standby database cancel; 
ORA-16136: Managed Standby Recovery not active


20:25:05 SYS @ gotime >alter database open;

^Calter database open
*
ERROR at line 1:
ORA-10458: standby database requires recovery
ORA-01196: file 1 is inconsistent due to a failed media recovery session
ORA-01110: data file 1: '/u01/app/oracle/oradata/gotime/system01.dbf'


Elapsed: 00:00:24.23

20:27:42 SYS @ gotime >recover managed standby database disconnect;
Media recovery complete.
20:28:50 SYS @ gotime >recover managed standby database cancel; 
Media recovery complete.
20:30:05 SYS @ gotime >alter database open;

Database altered.

Elapsed: 00:00:00.28

主库创建DML操作,进行测试,是否备库重新启动之后,Real Time Apply 消失….

20:31:13 SYS @ slow >create table t2000 as select * from t2017 where deptno < 20;

Table created.

Elapsed: 00:00:00.06
20:31:29 SYS @ slow >commit;

Commit complete.

Elapsed: 00:00:00.00
20:31:32 SYS @ slow >select * from t2000;

    DEPTNO DNAME     LOC
---------- -------------- -------------
    10 ACCOUNTING     NEW YORK
    10 ACCOUNTING     NEW YORK

2 rows selected.

Elapsed: 00:00:00.00
20:33:42 SYS @ slow >

此时备库的状态是open的,read only的,但是无法查询主库提交DML的数据,Real Time Appy 消失!!!

20:30:38 SYS @ gotime >select * from t2000;
select * from t2000
              *
ERROR at line 1:
ORA-00942: table or view does not exist


Elapsed: 00:00:00.00
20:31:39 SYS @ gotime >
20:33:44 SYS @ gotime >r
  1* select * from t2000
select * from t2000
              *
ERROR at line 1:
ORA-00942: table or view does not exist


Elapsed: 00:00:00.00
20:33:46 SYS @ gotime >

转载请注明 : sinkshark的博客

打赏一个呗

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

....