1、修改保护模式

  1. DGMGRL> edit configuration set protection mode as maxAvailability;
  2. Succeeded.

2、修改日志同步方式

  1. DGMGRL> show database verbose xiaohe 'LogXptMode'
  2. LogXptMode = 'ASYNC'
  3. DGMGRL> show database verbose xiaohedg 'LogXptMode'
  4. LogXptMode = 'ASYNC'
  5. DGMGRL> edit database xiaohe set property LogXptMode = 'SYNC';
  6. Property "logxptmode" updated
  7. DGMGRL> edit database xiaohedg set property LogXptMode = 'SYNC';
  8. Property "logxptmode" updated
  9. DGMGRL>
  10. DGMGRL> show database verbose xiaohe 'LogXptMode'
  11. LogXptMode = 'SYNC'
  12. DGMGRL> show database verbose xiaohedg 'LogXptMode'
  13. LogXptMode = 'SYNC'

3、在dgmgrl中配置主库与standby数据库的FastStartFailoverTarget属性

  1. DGMGRL> show database verbose xiaohe 'FastStartFailoverTarget';
  2. FastStartFailoverTarget = 'xiaohedg'
  3. DGMGRL> show database verbose xiaohedg 'FastStartFailoverTarget';
  4. FastStartFailoverTarget = 'xiaohe'

这里已经不用配置了, 如果需要配置, 使用如下的命令:
edit database xiaohedg set property FastStartFailoverTarget='xiaohe';

4、启动observer

DGMGRL> start observer
Observer started


5、在另外一个终端查看failover状态

可以看到Observer: xiaohe_dg1, 这里监控的就是主库。

  1. DGMGRL> show fast_start failover
  2. Fast-Start Failover: DISABLED
  3. Threshold: 30 seconds
  4. Target: (none)
  5. Observer: xiaohe_dg1
  6. Lag Limit: 30 seconds
  7. Shutdown Primary: TRUE
  8. Auto-reinstate: TRUE
  9. Configurable Failover Conditions
  10. Health Conditions:
  11. Corrupted Controlfile YES
  12. Corrupted Dictionary YES
  13. Inaccessible Logfile NO
  14. Stuck Archiver NO
  15. Datafile Offline YES
  16. Oracle Error Conditions:
  17. (none)


6、激活failover功能

  1. DGMGRL> enable fast_start failover;
  2. Enabled.

7、模拟故障

(1)、将主库给shutdown abort
  1. SQL> shutdown abort;
  2. ORACLE instance shut down.

(2)、等一两分钟, 查看observer的日志
  1. DGMGRL> start observer
  2. Observer started
  3. 23:56:08.19 Saturday, March 18, 2017
  4. Initiating Fast-Start Failover to database "xiaohe"...
  5. Performing failover NOW, please wait...
  6. Failover succeeded, new primary is "xiaohe"
  7. 23:56:11.64 Saturday, March 18, 2017


(3)、查看备库是否已经切换为主库
  1. SQL> select open_mode from v$database;
  2. OPEN_MODE
  3. --------------------
  4. READ WRITE

(4)、将故障的库重新启动
启动数据库报错:
  1. SQL> startup
  2. ORACLE instance started.
  3. Total System Global Area 839282688 bytes
  4. Fixed Size 2233000 bytes
  5. Variable Size 494931288 bytes
  6. Database Buffers 339738624 bytes
  7. Redo Buffers 2379776 bytes
  8. Database mounted.
  9. ORA-16649: possible failover to another database prevents this database from
  10. being opened



查看日志,下面的红色部分是新产生的日志:

  1. DGMGRL> start observer
  2. Observer started
  3. 23:56:08.19 Saturday, March 18, 2017
  4. Initiating Fast-Start Failover to database "xiaohe"...
  5. Performing failover NOW, please wait...
  6. Failover succeeded, new primary is "xiaohe"
  7. 23:56:11.64 Saturday, March 18, 2017
  8. 00:05:46.24 Sunday, March 19, 2017
  9. Initiating reinstatement for database "xiaohedg"...
  10. Reinstating database "xiaohedg", please wait...
  11. Operation requires shutdown of instance "xiaohedg" on database "xiaohedg"
  12. Shutting down instance "xiaohedg"...
  13. ORA-01109: database not open
  14. Database dismounted.
  15. ORACLE instance shut down.
  16. Operation requires startup of instance "xiaohedg" on database "xiaohedg"
  17. Starting instance "xiaohedg"...
  18. ORACLE instance started.
  19. Database mounted.
  20. Continuing to reinstate database "xiaohedg" ...
  21. Reinstatement of database "xiaohedg" succeeded
  22. 00:06:42.78 Sunday, March 19, 2017

等了几分钟后, 数据库自动恢复正常了。

经测试, 但故障的库只需要启动到mount状态, failover就能自动将库打开。


















DataGuard开启failover的更多相关文章

  1. DataGuard开启延时应用的测试

    DataGuard开启延时应用的测试 实验环境:RHEL 6.5 + Oracle 11.2.0.4 GI.DB + Primary RAC(2 nodes)+ Standby RAC(2 nodes ...

  2. Oracle Dataguard之failover

    Oracle Dataguard中,角色转换包含两类:Switchover和Failover.上文<Oracle Dataguard之switchover>中,我们已经谈过了switcho ...

  3. 物理dataguard 正常切换 脚色转换,switchover_status 状态改变

    正常切换切换前: 主库:SQL> select DATABASE_ROLE from v$database;DATABASE_ROLE----------------PRIMARY SQL> ...

  4. Redis Sentinel:集群Failover解决方案(转载)

    本文转载自:http://shift-alt-ctrl.iteye.com/blog/1884370 文中的配置例子,还有failover过程中触发的订阅事件具有很好的参考价值. Redis sent ...

  5. Duplicate复制数据库并创建物理StandBy(spfile+不同实例名+不同路径)

    过程和Duplicate复制数据库并创建物理StandBy类似,只是不需要重启数据库. 目的:创建standby,不重启源数据库 1设定环境如下: Primary数据库 IP 172.17.22.16 ...

  6. 基于Dubbo框架构建分布式服务(一)

    Dubbo是Alibaba开源的分布式服务框架,我们可以非常容易地通过Dubbo来构建分布式服务,并根据自己实际业务应用场景来选择合适的集群容错模式,这个对于很多应用都是迫切希望的,只需要通过简单的配 ...

  7. redis 集群热备自动切换sentinel配置实战

    ---恢复内容开始--- Redis SentinelSentinel(哨兵)是用于监控redis集群中Master状态的工具,其已经被集成在redis2.4+的版本中一.Sentinel作用:1): ...

  8. redis高可用之REDIS SENTINEL

    1. Redis主从配置 1.1. 设置主从复制 Master <= Salve 10.24.6.5:6379 <= 10.24.6.7:6379 1.2.   取消主从复制 1.3.   ...

  9. 基于Dubbo框架构建分布式服务

    Dubbo是Alibaba开源的分布式服务框架,我们可以非常容易地通过Dubbo来构建分布式服务,并根据自己实际业务应用场景来选择合适的集群容错模式,这个对于很多应用都是迫切希望的,只需要通过简单的配 ...

随机推荐

  1. MySQL里的COUNT

    count(*).count(1).count(主键).count(字段)的执行效率 在没有where条件的情况下 MyISAM引擎返回结果会比InnoDB快上很多,主要是因为MyISAM会单独记录了 ...

  2. (springboot)自定义Starter

    要引入的jar项目,即自定义的Starter项目: pom:(这里不能引入springboot整合否则测试项目注入失败) <?xml version="1.0" encodi ...

  3. mybatis多表查询之多对多关系查询的实现-xml方式

    Mybatis对于多对多关系下的查询提供了集合(collection)的概念来解决,collection属性是resultMap高级结果映射的子集,首先,在本例中我们使用的是集合元素来解决多对多的查询 ...

  4. C#简单爬取数据(.NET使用HTML解析器ESoup和正则两种方式匹配数据)

    一.获取数据 想弄一个数据库,由于需要一些人名,所以就去百度一下,然后发现了360图书馆中有很多人名 然后就像去复制一下,发现复制不了,需要登陆 此时f12查看源码是可以复制的,不过就算可以复制想要插 ...

  5. ArcMap和ArcGIS Pro加载百度地图

    前面发布了两篇我用ArcBruTile开发用于ArcMap加载百度地图的插件ArcBruTileBaidu,放在网上后评论和反响还不错,还有两位大学同学通过百度搜索居然搜到我本人!文章和技术介绍也被网 ...

  6. 监听input实时输入

    // 用Jquery实现: $('#input-element').on('input',()=>{ console.log("你按了一下111");}) // 用Jquer ...

  7. unity编辑器扩展_02(分别在Hierarchy,Project中创建一个选项)

    在Hierarchy面板创建选项的代码: [MenuItem("GameObject/Test",false,1)]    static void Test1()    {     ...

  8. HDU 5919 - Sequence II (2016CCPC长春) 主席树 (区间第K小+区间不同值个数)

    HDU 5919 题意: 动态处理一个序列的区间问题,对于一个给定序列,每次输入区间的左端点和右端点,输出这个区间中:每个数字第一次出现的位子留下, 输出这些位子中最中间的那个,就是(len+1)/2 ...

  9. CodeForces - 940E - Cashback +贪心+DP

    传送门:CodeForces - 940E - Cashback 题意:在一个长度为n的数组中,可以分出长度为 k 连续的多个数组b(每个数组 b 的 k 可不相同),然后,可以对每个数组 b 进行删 ...

  10. HDU-3507Print Article 斜率优化DP

    学习:https://blog.csdn.net/bill_yang_2016/article/details/54667902 HDU-3507 题意:有若干个单词,每个单词有一个费用,连续的单词组 ...