ITPub博客

首页 > 数据库 > Oracle > physical DB Real Time Apply(RTA实时应用)

physical DB Real Time Apply(RTA实时应用)

原创 Oracle 作者:大鲨鱼o0O 时间:2018-01-13 20:22:09 0 删除 编辑
PS:这些DG实现都是建立在我之前DG博客的基础上的

此时备库是mount状态

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

  2. STATUS
  3. ------------
  4. MOUNTED

  5. 1 row selected.

  6. Elapsed: 00:00:00.01

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

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

  2. Database altered.

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

  5. STATUS
  6. ------------
  7. OPEN

  8. 1 row selected.

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

  11. NAME     OPEN_MODE     DATABASE_ROLE    PROTECTION_MODE
  12. --------- -------------------- ---------------- --------------------
  13. SLOW     READ ONLY     PHYSICAL STANDBY MAXIMUM AVAILABILITY

  14. 1 row selected.

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


此时备库的告警日志信息 

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


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

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

  2.     DEPTNO DNAME     LOC
  3. ---------- -------------- -------------
  4.     10 ACCOUNTING     NEW YORK
  5.     20 RESEARCH     DALLAS
  6.     30 SALES     CHICAGO
  7.     40 OPERATIONS     BOSTON
  8.     10 ACCOUNTING     NEW YORK
  9.     20 RESEARCH     DALLAS
  10.     30 SALES     CHICAGO
  11.     40 OPERATIONS     BOSTON

  12. 8 rows selected.

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

  15. Table created.

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

  18. Commit complete.

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

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

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

  2.     DEPTNO DNAME     LOC
  3. ---------- -------------- -------------
  4.     10 ACCOUNTING     NEW YORK
  5.     20 RESEARCH     DALLAS
  6.     30 SALES     CHICAGO
  7.     40 OPERATIONS     BOSTON
  8.     10 ACCOUNTING     NEW YORK
  9.     20 RESEARCH     DALLAS
  10.     30 SALES     CHICAGO
  11.     40 OPERATIONS     BOSTON

  12. 8 rows selected.

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

  15.     DEPTNO DNAME     LOC
  16. ---------- -------------- -------------
  17.     10 ACCOUNTING     NEW YORK
  18.     20 RESEARCH     DALLAS
  19.     10 ACCOUNTING     NEW YORK
  20.     20 RESEARCH     DALLAS

  21. 4 rows selected.

  22. Elapsed: 00:00:00.00
  23. 20:15:36 SYS @ gotime >

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

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

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

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


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

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


  18. Elapsed: 00:00:24.23

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

  24. Database altered.

  25. Elapsed: 00:00:00.28

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

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

  2. Table created.

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

  5. Commit complete.

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

  8.     DEPTNO DNAME     LOC
  9. ---------- -------------- -------------
  10.     10 ACCOUNTING     NEW YORK
  11.     10 ACCOUNTING     NEW YORK

  12. 2 rows selected.

  13. Elapsed: 00:00:00.00
  14. 20:33:42 SYS @ slow >


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

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


  6. Elapsed: 00:00:00.00
  7. 20:31:39 SYS @ gotime >
  8. 20:33:44 SYS @ gotime >r
  9.   1* select * from t2000
  10. select * from t2000
  11.               *
  12. ERROR at line 1:
  13. ORA-00942: table or view does not exist


  14. Elapsed: 00:00:00.00
  15. 20:33:46 SYS @ gotime >




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

请登录后发表评论 登录
全部评论

注册时间:2016-10-26

  • 博文量
    32
  • 访问量
    5208