Oracle Dataguard一共支持三种模式:最大可用模式(Maximum Availability),最大性能模式(Maximum Performance),最大保护模式(Maximum Protection)。默认创建的是最大性能模式(Maximum Performance)。关于三者的区别,我们来看官方的定义。

Maximum Availability

Transactions do not commit until all redo data needed to recover those transactions has been written to the online redo log and to the standby redo log on at least one synchronized standby database.If the primary database cannot write its redo stream to at least one synchronized standby         database,it operates as if it were in maximum performance mode to preserve primary database availability until it is again able to write its redo stream to a synchronized standby database.

Maximum Performance

This is accomplished by allowing transactions to commit as soon as all redo data generated by those transactions has been written to the online log. Redo data is also written to one of more standby databases,but this is done asynchronously with respect to transaction commitment,so primary       database performance is unaffected by delays in writing redo data to the standby databases.

Maximum Protection

This protection mode ensures that no data loss will occur if the primary database fails.To provide this level of protection,the redo data needed to      recover a transaction must be written to both the online redo log and to the standby redo on at least one synchronized standby database before the transaction commits.To ensure that data loss cannot occur,the primary database will shut down,rather than continue processing transactions,if it     cannot write its redo stream to at least one synchronized standby database.

三种模式对于日志传输的要求如下:

在前篇文章中-《Oracle Dataguard之物理standby的基本配置》,我们最后配置出来的是Physical Standby Database 最大性能模式下的异步传输,现在我们配置该模式下的Real-Time Apply。启用Real-Time Apply需要配置standby redo log,而这也是其它两种模式的基础。

一、 创建standby redo log

1> 查询主库上online redo log的组数和大小   -->> node1 上操作

SQL> select group#,bytes/1024/1024 "size" from v$log;

GROUP#  size
         ------     ----------
         1             50
         2             50
         3             50

2> 在备库上添加standby redo log   -->> group比主库多一组,大小和主库一样,node2上操作

[oracle@node2 ~]$ mkdir /u01/standby

SQL> alter database add standby logfile '/u01/standby/standby01.log' size 50M;

SQL> alter database add standby logfile '/u01/standby/standby02.log' size 50M;

SQL> alter database add standby logfile '/u01/standby/standby03.log' size 50M;

SQL> alter database add standby logfile '/u01/standby/standby04.log' size 50M;

注意:请确保已关闭Redo Apply,不然会报以下错误

SQL> alter database add standby logfile '/u01/standby/standby01.log' size 50M;

alter database add standby logfile '/u01/standby/standby01.log' size 50M
                 *
                 ERROR at line 1:
                 ORA-01156: recovery or flashback in progress may need access to files

关闭Redo Apply,

SQL> alter database recover managed standby database cancel;

二、 修改主库的配置参数  -->> node1 上操作

SQL> alter system set log_archive_dest_2='service=to_victor lgwr affirm sync valid_for=(online_logfiles,primary_role) db_unique_name=victor';

SQL> alter system switch logfile;

三、 在备库上启用Real-Time Apply  -->> node2 上操作

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

四、 测试

除了用前篇文章中,查看归档日志的应用情况来验证dataguard的配置以外,本文将采用实际案例进行测试。

1> 在主库上新建一个测试表

SQL> create table test(id number);

SQL> insert into test values(1);

2> 在备库中检测

SQL> select * from test;

no rows selected

3> 在主库中提交事务

SQL> commit;

4> 在备库中检测

SQL> select * from test;

ID
          ----------
          1

总结:

这个总结包括物理standby的基本配置和本文中的Real-Time Apply

1> 如果只设置主/次两个本地归档目的地,可以使用初始化参数log_archive_dest指定主归档目的地,使用初始化参数log_archive_duplex_dest指定次归档目的地。

在数据库中,初始换参数log_archive_dest和log_archive_duplex_dest与log_archive_dest_n只能使用一组来设置归档目的地,不能同时使用

2> 备库log_archive_dest_1如果没有显性指定,默认的归档目录将是$ORACLE_HOME/dbs.倘若显性指定,但valid_for不是

(standby_logfiles,standby_role)或者(all_logfiles,all_roles),则该设置无效,报警日志中将报以下错误:

ORA-16032: parameter STANDBY_ARCHIVE_DEST destination string cannot be translated

归档目录将继续为$ORACLE_HOME/dbs

3> 在本文中,log_archive_dest_1='location=/u01/archivelog valid_for=(standby_logfiles,standby_role) db_unique_name=victor',如果再显性指定

log_archive_dest_3='location=/u01/standbyarchive valid_for=(standby_logfiles,standby_role) db_unique_name=victor',将会有两份standby的

归档日志产生,没有必要,只需要一个log_archive_dest_1即可

4> 最大性能模式下,如果是async,即异步,则需要主库切一次日志,备库采用应用。而如果启用Real-Time Apply,则只需要主库事务commit, 备库就能应用

5> 删除日志

SQL> alter database drop logfile group 7;

6> 如果发出了alter database recover managed standby database cancel;这个命令,MRP(Media Recovery process)将停止工作,但

RFS(Remote file server)仍继续工作

7> 如果没有standby redo logs,是不能启动real time apply的

SQL> alter database recover managed standby database using current logfile disconnect from session;
           alter database recover managed standby database using current logfile disconnect from session
           *
           ERROR at line 1:
           ORA-38500: USING CURRENT LOGFILE option not available without standby redo logs

8> standby数据库startup后,没有发出alter database recover managed standby database disconnect from session这个命令,RFS仍然工作,只要监听

都ok

9> disconnect from session代表这个命令后台运行。

10> Real-Time Apply的原理图

Oracle Dataguard之Real-Time Apply相关推荐

  1. Oracle dataguard一主两备环境搭建

    Oracle dataguard一主两备环境搭建 测试环境说明: 主 库:Reahat 6.5 x64 + Oracle 11.2.0.3 x64 单机(IP:192.168.6.10  db)  D ...

  2. ORACLE Dataguard安装

    ORACLE Dataguard安装 花了一周时间,终于部署和稳定都整理好了. 拷贝到blog里, 留份记录. 也算是对大家的贡献吧. 当然这篇技术文档很大一部分归功于这位仁兄:  http://bl ...

  3. oracle logical standby,Oracle Dataguard管理命令(logical standby)

    Oracle Dataguard管理命令(logical standby) ################# ##  管理命令: ################# 1.注册日志的命令standby ...

  4. Oracle DataGuard 之--Physical DG转换Logical DG

    Oracle DataGuard 之--Physical DG转换Logical DG 一.Physical DG和Logical DG Physical Standby使用的是Media Recov ...

  5. oracle dataguard 日志 很多no,Oracle DataGuard主庫丟失歸檔日志后備庫的RMAN增量恢復一例...

    第一部分  問題描述和環境狀態確認 ----1. 問題場景 Oracle DataGuard主庫丟失archivelog,如何不重建備庫完成同步? 在Oracle DataGuard主從同步過程中可能 ...

  6. Oracle DataGuard介绍

     DataGuard 概述 DataGuard工作流程 主库把日志传输到备库,主库记录所有的操作信息,通过两种方式传输: 1:通过LNS(监听网络服务)传输到远程,通过service定义远程数据库, ...

  7. oracle dataguard详解,Oracle DataGuard数据备份方案详解

    Oracle DataGuard是一种数据库级别的HA方案,最主要功能是冗灾.数据保护.故障恢复等. 在生产数据库的"事务一致性"时,使用生产库的物理全备份(或物理COPY)创建备 ...

  8. oracle dataguard延迟,Oracle DataGuard延迟应用归档归档日志

    1. 查看主库的参数设置: SQL> show parameter log_archive_dest_2 NAME TYPE VALUE ---------------------------- ...

  9. oracle不一致性关闭下次,Oracle DataGuard

    ```1.文档介绍 本实施方案主要对Oracle DataGuard实施部署作相应的说明.以便实施人员能根据当前业务特点,规划.建设符合高可用.高可靠的数据库集群系统.具体由Oracle DG环境拓扑 ...

最新文章

  1. 网站开发流程以及HTML5简介(三)
  2. GitHub使用指南!(ubuntu)
  3. jsp:请求转发和重定向
  4. python批量读取文件名_python - 从路径中提取文件名,无论os / path形式如何
  5. vue根据url获取内容axios_vue+vuex+axios从后台获取数据存入vuex,组件之间共享数据...
  6. 从xml数据集到FairMOT数据集转换
  7. 概率语言模型及其变形系列-LDA及Gibbs Sampling
  8. an existing tansporter instance is currently uploading this package 解决方法
  9. 搭建Yum服务器及编译安装Httpd实验
  10. 实用干货!大数据入门的常用技术栈全在这里了
  11. 无盘服务器1410M,【说好的每周一贴】网维9系整套施工指南及常见问题与解决方法!!...
  12. 非常好用的php单文件在线文件管理器微网盘系统 万维景盛优化版
  13. Ubuntu速配指南之软件参考
  14. springboot 银联支付(扫码支付)
  15. 【转载】堆排序算法(图解详细流程)
  16. 【文件IO】Linux 文件操作(一) —— 遍历指定目录下的所有文件
  17. DB2 with的定义与用法
  18. CAD/CAM 软件架构总结
  19. node批量修改文件扩展名
  20. 基于扩展卡尔曼滤波(EKF)和低成本传感器的AHRS实现

热门文章

  1. 算法实验--主函数只有五行的Floyed的算法以及最短路径输出
  2. 从硬件到框架,30+巨头参与的AI基准竞争结果公布(第一回合)
  3. Kotlin的解析(中)
  4. python 简易HTTP服务器搭建
  5. 吴恩达 NIPS 2016:利用深度学习开发人工智能应用的基本要点(含唯一的中文版PPT)...
  6. Windows GPT磁盘GUID结构详解
  7. 要做linux运维工程师的朋友,必须要掌握以下几个工具才行
  8. 吉特仓库管理系统-- 后台管理开源啦,源码大放送
  9. 用Play 1.x 实现简单云计算多租户设计(Use Play 1.x To Achieve Multi-Tenancy Design)
  10. 关于mysql中truncate