DG Broker如何搭建

这篇文章主要介绍了DG Broker如何搭建,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

DG Broker搭建 

1.环境说明

database sid  db_name  db_unique_name net service  name
primary  ogg ogg ogg ogg_p
physical standby dogg ogg dogg dogg_s

2.查看参数

—-主库

SYS@ogg>show parameter broker

NAME                               TYPE       VALUE

———————————— ———– ——————————

dg_broker_config_file1             string     /u01/app/oracle/product/11.2.0 /dbhome_1/dbs/dr1ogg.dat

dg_broker_config_file2             string     /u01/app/oracle/product/11.2.0 /dbhome_1/dbs/dr2ogg.dat

dg_broker_start                    boolean     FALSE

—-备库

SYS@dogg> show parameter broker

NAME                               TYPE     VALUE

———————————— ———– ——————————

dg_broker_config_file1             string     /u01/app/oracle/product/11.2.0 /db_1/dbs/dr1dogg.dat

dg_broker_config_file2             string     /u01/app/oracle/product/11.2.0/db_1/dbs/dr2dogg.dat

dg_broker_start                    boolean    FALSE

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

3.启用BROKER

—-在两个数据库上面都执行:

alter system set dg_broker_start=true scope=both;

4.登录配置

—在其中任意一台做下面的操作就可以了,另它安装了client的客户端也是可以的

[oracle@ogg-80 ~]$ dgmgrl

(1)连接到当前的主数据库

DGMGRL> connect sys/oracle@ogg_p

DGMGRL> help create    —–查看帮助

Creates a broker configuration

Syntax:

  CREATE CONFIGURATION <configuration name> AS

    PRIMARY DATABASE IS <database name>

    CONNECT IDENTIFIER IS <connect identifier>;

(2)创建一个配置文件(ogg是db_unique_name,oggDG是配置的名字–可以修改,ogg_p是连接到prod数据库的tnsname)

create configuration oggDG as primary database is ogg connect identifier is ogg_p;

(3)启用配置文件

DGMGRL> enable configuration;

(4)增加备库到配置文件中 (dogg是备机的db_unique_name,dogg_s是连接到sprod数据库的tnsname)

DGMGRL> add database dogg as connect identifier is dogg_s;

(5)启用备库

DGMGRL> enable database dogg;

(6)查看配置文件

DGMGRL> show configuration

Configuration – oggdg

  Protection Mode: MaxPerformance

  Databases:

    ogg  – Primary database

    dogg – Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:

SUCCESS

(7)查看主库的配置消息

DGMGRL> show database verbose ogg;

Database – ogg

  Role:            PRIMARY

  Intended State:  TRANSPORT-ON

  Instance(s):

    ogg

  Properties:

    DGConnectIdentifier             = 'ogg_p'

    ObserverConnectIdentifier       = ''

    LogXptMode                      = 'ASYNC'

    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               = '/u01/app/oracle/oradata/dogg/, /u01/app/oracle/oradata/ogg/'

    LogFileNameConvert              = '/u01/app/oracle/oradata/dogg/, /u01/app/oracle/oradata/ogg/'

    FastStartFailoverTarget         = ''

    InconsistentProperties          = '(monitor)'

    InconsistentLogXptProps         = '(monitor)'

    SendQEntries                    = '(monitor)'

    LogXptStatus                    = '(monitor)'

    RecvQEntries                    = '(monitor)'

    ApplyLagThreshold               = '0'

    TransportLagThreshold           = '0'

    TransportDisconnectedThreshold  = '30'

    SidName                         = 'ogg'

    StaticConnectIdentifier         = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ogg-80)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ogg_DGMGRL)(INSTANCE_NAME=ogg)(SERVER=DEDICATED)))'

    StandbyArchiveLocation          = '/u01/app/oracle/archive'

    AlternateLocation               = ''

    LogArchiveTrace                 = '0'

    LogArchiveFormat                = '%t_%s_%r.dbf'

    TopWaitEvents                   = '(monitor)'

Database Status:

SUCCESS

(8)查看备库的配置消息

DGMGRL> show database verbose dogg;

Database – dogg

  Role:            PHYSICAL STANDBY

  Intended State:  APPLY-ON

  Transport Lag:   0 seconds (computed 0 seconds ago)

  Apply Lag:       0 seconds (computed 0 seconds ago)

  Apply Rate:      0 Byte/s

  Real Time Query: ON

  Instance(s):

    dogg

  Properties:

    DGConnectIdentifier             = 'dogg_s'

    ObserverConnectIdentifier       = ''

    LogXptMode                      = 'ASYNC'

    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               = '/u01/app/oracle/oradata/ogg/, /u01/app/oracle/oradata/dogg/'

    LogFileNameConvert              = '/u01/app/oracle/oradata/ogg/, /u01/app/oracle/oradata/dogg/'

    FastStartFailoverTarget         = ''

    InconsistentProperties          = '(monitor)'

    InconsistentLogXptProps         = '(monitor)'

    SendQEntries                    = '(monitor)'

    LogXptStatus                    = '(monitor)'

    RecvQEntries                    = '(monitor)'

    ApplyLagThreshold               = '0'

    TransportLagThreshold           = '0'

    TransportDisconnectedThreshold  = '30'

    SidName                         = 'dogg'

    StaticConnectIdentifier         = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=d-ogg)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=dogg_DGMGRL)(INSTANCE_NAME=dogg)(SERVER=DEDICATED)))'

    StandbyArchiveLocation          = '/u01/app/oracle/archive'

    AlternateLocation               = ''

    LogArchiveTrace                 = '0'

    LogArchiveFormat                = '%t_%s_%r.dbf'

    TopWaitEvents                   = '(monitor)'

Database Status:

SUCCESS

(9)修改StaticConnectIdentifier参数,记得两个数据库都要修改。

DGMGRL>  edit database ogg set property  StaticConnectIdentifier='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.80)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ogg)(SERVER=DEDICATED)))';

DGMGRL>  edit database dogg set property  StaticConnectIdentifier='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.90)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=dogg)(SERVER=DEDICATED)))';

(10)开始切换

DGMGRL>  switchover to dogg;

Performing switchover NOW, please wait…

Operation requires a connection to instance "dogg" on database "dogg"

Connecting to instance "dogg"…

Connected.

New primary database "dogg" is opening…

Operation requires startup of instance "ogg" on database "ogg"

Starting instance "ogg"…

ORACLE instance started.

Database mounted.

Database opened.

Switchover succeeded, new primary is "dogg"

(11)查看状态

DGMGRL> show configuration;

Configuration – oggdg

  Protection Mode: MaxPerformance

  Databases:

    dogg – Primary database

    ogg  – Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:

SUCCESS

(12)再次切换回去

DGMGRL> switchover to ogg;

感谢你能够认真阅读完这篇文章,希望小编分享的“DG Broker如何搭建”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/201822.html

(0)
上一篇 2021年11月25日
下一篇 2021年11月25日

相关推荐

发表回复

登录后才能评论