Dataguard Broker的配置

简介: 修改参数参数DG_BROKER_START设置为true

前提条件


修改参数

参数DG_BROKER_START设置为true

SQL> alter system set dg_broker_start=true;
System altered.


这个参数可以联机改,主库备库都改。


SQL> show parameter dg_
NAME         TYPE  VALUE
------------------------------------ ----------- ------------------------------
dg_broker_config_file1       string  /home/oracle/app/oracle/produc
       t/11.2.0/dbhome_1/dbs/dr1orcld
       g.dat
dg_broker_config_file2       string  /home/oracle/app/oracle/produc
       t/11.2.0/dbhome_1/dbs/dr2orcld
       g.dat
dg_broker_start        boolean  TRUE


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


在主库和备库的监听上实现静态注册

修改监听配置,主库:

[oracle@primary ~]$  cat  /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.83.?)(PORT = 1521))
    )
  )
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = orcl)
      (SID_NAME = orcl)
      (ORACLE_HOME =/home/oracle/app/oracle/product/11.2.0/dbhome_1)
    )
    (
     SID_DESC=(SID_NAME=orcl)
     (GLOBAL_DBNAME=orcl_DGMGRL)
     (ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1)
     (ENVS="TNS_ADMIN=/home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin")
    )
  )



备库


[oracle@standby ~]$ cat  /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.83.235)(PORT = 1521))
    )
  )
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = orcl)
      (SID_NAME = orcl)
      (ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_1)
    )
    (
     SID_DESC=(SID_NAME=orcl)
     (GLOBAL_DBNAME=orcldg_DGMGRL)
     (ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1)
     (ENVS="TNS_ADMIN=/home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin")
    )
  )



创建配置

启用BROKER,在主库上登录dgmgrl。

[oracle@primary ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys
Password:
Connected.


先查看一下创建配置文件的语法:


DGMGRL> help create;
Creates a broker configuration
Syntax:
  CREATE CONFIGURATION <configuration name> AS
    PRIMARY DATABASE IS <database name>
    CONNECT IDENTIFIER IS <connect identifier>;


写面创建配置文件


DGMGRL> create configuration dg as primary database is orcl connect identifier is orcl;
Configuration "dg" created with primary database "orcl"


创建完了检查一下,发现没有备库,而且配置文件没有被激活。

DGMGRL> show configuration
Configuration - dg
  Protection Mode: MaxAvailability
  Databases:
    orcl - Primary database
Fast-Start Failover: DISABLED
Configuration Status:
DISABLED


增加一个备库:


DGMGRL> add database orcldg as connect identifier is orcldg;
Database "orcldg" added
DGMGRL> show configuration
Configuration - dg
  Protection Mode: MaxAvailability
  Databases:
    orcl   - Primary database
    orcldg - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
DISABLED

激活配置文件,不然broker用不了。


DGMGRL> enable configuration

Enabled.


检查配置的详细信息:


DGMGRL> show database verbose orcl
Database - orcl
  Role:            PRIMARY
  Intended State:  TRANSPORT-ON
  Instance(s):
    orcl
  Database Warning(s):
    ORA-16629: database reports a different protection level from the protection mode
  Properties:
    DGConnectIdentifier             = 'orcl'
    ObserverConnectIdentifier       = ''
    LogXptMode                      = 'SYNC'
    DelayMins                       = '0'
    Binding                         = 'optional'
    MaxFailure                      = '0'
    MaxConnections                  = '1'
    ReopenSecs                      = '300'
    NetTimeout                      = '30'
    RedoCompression                 = 'DISABLE'
    LogShipping                     = 'ON'
    PreferredApplyInstance          = ''
    ApplyInstanceTimeout            = '0'
    ApplyParallel                   = 'AUTO'
    StandbyFileManagement           = 'auto'
    ArchiveLagTarget                = '0'
    LogArchiveMaxProcesses          = '4'
    LogArchiveMinSucceedDest        = '1'
    DbFileNameConvert               = ''
    LogFileNameConvert              = ''
    FastStartFailoverTarget         = ''
    StatusReport                    = '(monitor)'
    InconsistentProperties          = '(monitor)'
    InconsistentLogXptProps         = '(monitor)'
    SendQEntries                    = '(monitor)'
    LogXptStatus                    = '(monitor)'
    RecvQEntries                    = '(monitor)'
    HostName                        = 'primary'
    SidName                         = 'orcl'
    StaticConnectIdentifier         = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=primary)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl_DGMGRL)(INSTANCE_NAME=orcl)(SERVER=DEDICATED)))'
    StandbyArchiveLocation          = '/home/oracle/app/oradata/orcl/archive'
    AlternateLocation               = ''
    LogArchiveTrace                 = '0'
    LogArchiveFormat                = '%t_%s_%r.arc'
    TopWaitEvents                   = '(monitor)'
Database Status:
WARNING
DGMGRL>

注意参数StaticConnectIdentifier中SERVICE_NAME的命名规则是db_unique_name_DGMGRL.db_domain,如果在监听的配置文件中配置时不是这样的命名,需要手工修改StaticConnectIdentifier这个参数。


参考文档Oracle官方文档《Data Guard Broker》


相关文章
|
消息中间件 RocketMQ 监控
rocketMq - master/slave同步
本章主要需要讲清楚两个概念,第一个是slave主动和master同步,第二个是master主动和slave同步。而且我保证这是唯一一篇能够把这两个过程讲清楚的文章,至少在这篇文章之前我找了很多文章,没有一篇文章将整个过程合起来讲解清楚的,说明还是花了时间在里面的。
1329 0
|
Oracle 关系型数据库 Linux
|
监控 数据库 关系型数据库
|
Oracle 网络协议 关系型数据库