zoukankan      html  css  js  c++  java
  • Oracle broker--详解

    1,简介

      01,介绍

      Data Guard broker是建立在Data Guard基础上的一个对Data Guard配置,集中管理操作的一个平台.我们再上次DG主备切换的时候会发现特别麻烦,为此broker出来了.

      02,DGbroker的三种保护模式

        – Maximum protection

      在Maximum protection下, 可以保证从库和主库数据完全一样,做到zero data loss.事务同时在主从两边提交完成,才算事务完成。如果从库宕机或者网络出现问题,主从库不能通讯,主库也立即宕机。在这种方式下,具有最高的保护等级。但是这种模式对主库性能影响很大,要求高速的网络连接。

        – Maximum availability

      在Maximum availability模式下,如果和从库的连接正常,运行方式等同Maximum protection模式,事务也是主从库同时提交。如果从库和主库失去联系,则主库自动切换到Maximum performance模式下运行,保证主库具有最大的可用性。

        – Maximum performance

      在Maximum performance,主库把归档的 archived log通过arch进程传递给从库,在这种方式下,主库运行性能最高,但是不能保证数据不丢失,且丢失的数据受redo log的大小影响。在redo log过大的情况下,可能一天都没有归档一个日志,可以通过手工切换日志的方式来减小数据的丢失。

      03,查看DGbroker的模式

    show configuration verbose;

    二,配置

      01,配置监听,主库添加

       (SID_DESC =
    
         (GLOBAL_DBNAME=oracle01_DGMGRL)
    
         (ORACLE_HOME =/u01/app/oracle/product/12.1.0/db_1)
    
         (SID_NAME =oracle01)
    
       )

    lsnrctl reload

      02,备库配置监听

       (SID_DESC =
    
         (GLOBAL_DBNAME=standby_DGMGRL)
    
         (ORACLE_HOME =/u01/app/oracle/product/12.1.0/db_1)
    
         (SID_NAME =standby)
    
       )

    lsnrctl reload

      03,主备配置操作

    show parameter dg_broker_config_file
    
    
    可以修改dg_broker_config_file参数。这里就用默认的路径,也可以自己指定。如果是在RAC环境中,这个把这个文件把到共享的存储上面,如果有ASM可以放到ASM中。

        启动broker

    alter system set dg_broker_start=true;

      04,主库操作

    运行:
        dgmgrl
    
    连接数据库
    DGMGRL> connect sys/123456@oracle01
    
    帮助命令
        
     DGMGRL>help create
    
    创建   
    
     DGMGRL>create configuration dg as primary database is oracle01  connect identifier is oracle01;
    
    如果发现创建出错,或者其他原因
    可以执行
    DGMGRL> remove configuration;
    Removed configuration

    启用配置文件

    enable configuration

    ----------------------------------------------------------------------------------------------
    如果是12G 出现 ORA-16698错误那可以
    通过在Primary 和 Standby上取消log_archive_dest_n参数来解决,
    实际这一块的参数应当是交给DG broker 来管理了,不再需要人为介入设置。
      即执行: alter system set log_archive_dest_2='';
      然后继续执行:create configuration dg as primarydatabase is oracle01 connect identifier is oracle01
    ----------------------------------------------------------------------------------------------

      05,备库操作

    DGMGRL> add database standby as connect identifier is standby;
    Database "standby" added

    DGMGRL>show configuration ----查看
    
    

      06,查看详细配置

    DGMGRL>show database verbose oracle01
    
    DGMGRL>show database verbose standby

      07,配置错误

    DGMGRL> show database standby;
    
    Database - standby
    
      Role:            PHYSICAL STANDBY
      Intended State:  APPLY-ON
      Transport Lag:   0 seconds (computed 81 seconds ago)
      Apply Lag:       (unknown)
      Apply Rate:      (unknown)
      Real Time Query: OFF
      Instance(s):
        standby
          Error: ORA-16797: database is not using a server parameter file
    
    Database Status:
    ERROR

      是因为需要设置spfile的

    SQL>  show parameter spfile
    
    NAME                     TYPE     VALUE
    ------------------------------------ ----------- ------------------------------
    spfile                     string
    SQL>  create spfile from pfile;
    
    File created.
    
    SQL> shutdown immediate;
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> startup
    ORACLE instance started.
    
    Total System Global Area 2505338880 bytes
    Fixed Size            2255832 bytes
    Variable Size          603980840 bytes
    Database Buffers     1879048192 bytes
    Redo Buffers           20054016 bytes
    Database mounted.
    Database opened.
    SQL> show parameter spfile
    
    NAME                     TYPE     VALUE
    ------------------------------------ ----------- ------------------------------
    spfile                     string     /u01/app/oracle/product/11.2.0
                             /db_1/dbs/spfilestandby.ora
    SQL>

      08,错误2

    DGMGRL> show configuration
    
    Configuration - dg
    
      Protection Mode: MaxPerformance
      Databases:
        oracle01 - Primary database
        standby  - Physical standby database
          Error: ORA-16766: Redo Apply is stopped
    
    Fast-Start Failover: DISABLED
    
    Configuration Status:
    ERROR

    很清楚了,进程停

    尝试启动:

    DGMGRL> edit database 'standby' set state='apply-on';
    Succeeded.

      

     

      

        

        

        

  • 相关阅读:
    TinyXML 2.4.2发布
    OpenAL 1.1 Release
    Microsoft ship Visual Studio 2005 and .NET 2.0
    Boost中文站
    第一次Blog
    POJ3020 Antenna Placement 二分图匹配+拆点构图
    SGU438 The Glorious Karlutka River =) 最大流(动态流问题)
    HDU2732 Leapin' Lizards 最大流
    SGU176 Flow construction 有上下界的最小流
    POJ1459 Power Network 网络流
  • 原文地址:https://www.cnblogs.com/kingle-study/p/10483238.html
Copyright © 2011-2022 走看看