暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Oracle | Data Guard Broker 实战及管理(二)

数据库实用技能 2021-04-19
2449


Broker设置准备工作


设置primary和standby使用spfile。


        配置DG_BROKER_CONFIG_FILEn(可选)


  针对DG_BROKER_CONFIG_FILEn可以不做特别的设置,使用默认的$ORACLE_HOME/dbs目录以及两个默认的文件名dr1.dat和dr2.dat。

也可以通过以下设置指定目录:

Alter system set 

dg_broker_config_file1='/data/dg/11.2.0.2/A10db/dbs/dr1.dat';

alter system set 

dg_broker_config_file2='/data/dg/11.2.0.2/A10db/dbs/dr2.dat';


         设置primary和standby的local_listener参数(主备)


这一步设置是为了保证一些service name能正确的被注册上

SQL> alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)

   (HOST=10.13.196.72)(PORT=1521))';


         设置dg_broker_start初始化参数(主备都必须)


   这一步是启动Data Guard broker monitor(DMON)进程。

   SQL> alter system set dg_broker_start=true scope=both;


正式配置Broker (主库)


  

   现在可以配置broker了,为了保证配置过程不会因为权限问题导致问题,始终都是用sys连接数据库。

  首先使用DGMGRL连接到primary机器上,运行下面的命令:

[@adcpc15 ~]$ dgmgrl 或dgmgrl sys/passwd@tnsname

DGMGRL for Linux: Version 11.2.0.2.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.

DGMGRL> connect 连接数据库//

Connected.

DGMGRL>

DGMGRL> show configuration; 查看当前配置//

Error:

ORA-16525: the Data Guard broker is not yet available

Configuration details cannot be determined by DGMGRL

DGMGRL>


创建primary配置并启用配置


DGMGRL>create configuration dg_abc as PRIMARY DATABASE IS adc17 CONNECT IDENTIFIER IS "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.11.202.84)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SID=adc17)))";

DGMGRL> enable configuration;


添加standby库并启用配置


DGMGRL> add database s1adc17 as connect identifier is "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.11.202.86)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SID=adc17)))" maintained as physical;

DGMGRL> enable database s1adc17;

DGMGRL> add database s2adc17 as connect identifier is "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.11.196.74)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SID=adc17)))" maintained as physical;

DGMGRL> enable database s2adc17;

DGMGRL> add database s3adc17 as connect identifier is "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.11.193.42)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SID=adc17)))" maintained as physical;

DGMGRL> enable database s3adc17;


查看配置


DGMGRL> show configuration;

Configuration - dg_adc17

Protection Mode: MaxPerformance

Databases:

adcpc17 - Primary database

Warning: ORA-16789: standby redo logs not configured

s1adc17 - Physical standby database

s2adc17 - Physical standby database

s3adc17 - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:

WARNING

DGMGRL>


这样就成功完成了broker的设置,主备已经通过dg进行管理了。


文章转载自数据库实用技能,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论