你好,游客 登录 注册 搜索
背景:
阅读新闻

Oracle RAC 11g DG Broker配置和测试

[日期:2017-08-18] 来源:Linux社区  作者:jyzhao [字体: ]

Oracle RAC 11g DG Broker配置和测试

之前在《RHEL6.4 + Oracle 11g DG测试环境快速搭建参考》已经简单说过。
本篇在实验环境中实际配置
环境: RHEL 6.5 + Oracle 11.2.0.4 GI、DB + Primary RAC(2 nodes)+ Standby RAC(2 nodes)
该实验环境的搭建可参考:模拟生产搭建Standby RAC实验环境(11.2.0.4 DG)

配置并测试DG Broker步骤:

  • 1.停止MRP
  • 2.修改 Listener.ora 文件
  • 3.修改参数文件
  • 4.创建配置
  • 5.启用配置
  • 6.切换测试

1.停止MRP

在备库停止MRP:

alter database recover managed standby database cancel;

2.修改 Listener.ora 文件

在各个节点grid用户的监听文件中,

[grid@jyrac1 ~]$ cd $ORACLE_HOME/network/admin
[grid@jyrac1 admin]$ vi listener.ora

分别增加以下内容:

--Primary Node1
SID_LIST_LISTENER=(SID_LIST=(SID_DESC=(SID_NAME=jyzhao1)(GLOBAL_DBNAME=jyzhao_dgmgrl)(ORACLE_HOME=/opt/app/oracle/product/11.2.0/dbhome_1)))
 
--Primary Node2
 
SID_LIST_LISTENER=(SID_LIST=(SID_DESC=(SID_NAME=jyzhao2)(GLOBAL_DBNAME=jyzhao_dgmgrl)(ORACLE_HOME=/opt/app/oracle/product/11.2.0/dbhome_1)))
 
--Standby Node1
 
SID_LIST_LISTENER=(SID_LIST=(SID_DESC=(SID_NAME=jyzhao1)(GLOBAL_DBNAME=mynas_dgmgrl)(ORACLE_HOME=/opt/app/oracle/product/11.2.0/dbhome_1)))
 
--Standby Node2
 
SID_LIST_LISTENER=(SID_LIST=(SID_DESC=(SID_NAME=jyzhao2)(GLOBAL_DBNAME=mynas_dgmgrl)(ORACLE_HOME=/opt/app/oracle/product/11.2.0/dbhome_1)))

注:因为我这里的环境之前没有配置其他的静态监听,而且默认使用的监听名字是LISTENER,所以,只需要直接添加这一行配置即可。
添加完毕后分别在各节点重新启动监听:

--@all nodes
lsnrctl stop
lsnrctl start

3.修改参数文件

检查当前DG_BROKER_CONFIG_FILE和dg_broker_start配置:

--ON Primary:

SYS@jyzhao1 >show parameter dg_broker

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
dg_broker_config_file1               string      /opt/app/oracle/product/11.2.0
                                                 /dbhome_1/dbs/dr1jyzhao.dat
dg_broker_config_file2               string      /opt/app/oracle/product/11.2.0
                                                 /dbhome_1/dbs/dr2jyzhao.dat
dg_broker_start                      boolean     FALSE

--ON Standby:

SQL> show parameter dg_broker

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
dg_broker_config_file1               string      /opt/app/oracle/product/11.2.0
                                                 /dbhome_1/dbs/dr1mynas.dat
dg_broker_config_file2               string      /opt/app/oracle/product/11.2.0
                                                 /dbhome_1/dbs/dr2mynas.dat
dg_broker_start                      boolean     FALSE

需要把DG Broker配置文件的默认路径修改到ASM磁盘上,并将dg_broker_start修改为TRUE,具体操作如下:

--ON Primary:
ASMCMD>
mkdir +fra1/jyzhao/DATAGUARDCONFIG
mkdir +data1/jyzhao/DATAGUARDCONFIG
 
SQL>
ALTER SYSTEM SET DG_BROKER_CONFIG_FILE1='+fra1/jyzhao/DATAGUARDCONFIG/dgb_config1.ora' SCOPE=BOTH sid='*';
ALTER SYSTEM SET DG_BROKER_CONFIG_FILE2='+data1/jyzhao/DATAGUARDCONFIG/dgb_config2.ora' SCOPE=BOTH sid='*';
alter system set dg_broker_start=true scope=both sid='*';
show parameter dg_broker

--ON Standby:
ASMCMD>
mkdir +fra/mynas/DATAGUARDCONFIG
mkdir +data/mynas/DATAGUARDCONFIG
 
SQL>
ALTER SYSTEM SET DG_BROKER_CONFIG_FILE1='+fra/mynas/DATAGUARDCONFIG/dgb_config1.ora' SCOPE=BOTH sid='*';
ALTER SYSTEM SET DG_BROKER_CONFIG_FILE2='+data/mynas/DATAGUARDCONFIG/dgb_config2.ora' SCOPE=BOTH sid='*';
alter system set dg_broker_start=true scope=both sid='*';
show parameter dg_broker

此时,主备库的alert告警日志中都会有启动DG Broker的信息:

Sun Aug 13 16:45:27 2017
DMON started with pid=41, OS id=7432 
Starting Data Guard Broker (DMON)
Sun Aug 13 16:45:49 2017
INSV started with pid=54, OS id=7459 

4.创建配置

dgmgrl sys/oracle
在dgmgrl下创建配置:

CREATE CONFIGURATION 'jydb' AS PRIMARY DATABASE IS 'jyzhao' CONNECT IDENTIFIER IS 'jyzhao';
ADD DATABASE 'mynas' AS CONNECT IDENTIFIER IS 'mynas';

实际操作如下:

DGMGRL> CREATE CONFIGURATION 'jydb' AS PRIMARY DATABASE IS 'jyzhao' CONNECT IDENTIFIER IS 'jyzhao';
Configuration "jydb" created with primary database "jyzhao"

DGMGRL> ADD DATABASE 'mynas' AS CONNECT IDENTIFIER IS 'mynas';
Database "mynas" added

5.启用配置

在dgmgrl下启用配置,查看配置:

enable configuration;
show configuration;   
show database verbose jyzhao

实际操作如下:

DGMGRL> enable configuration;
Enabled.

DGMGRL> show configuration;   

Configuration - jydb

  Protection Mode: MaxPerformance
  Databases:
    jyzhao - Primary database
    mynas  - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

DGMGRL> show database verbose jyzhao

Database - jyzhao

  Role:            PRIMARY
  Intended State:  TRANSPORT-ON
  Instance(s):
    jyzhao1
    jyzhao2

  Properties:
    DGConnectIdentifier             = 'jyzhao'
    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               = '+data/mynas, +data1/jyzhao'
    LogFileNameConvert              = '+data/mynas, +data1/jyzhao, +fra/mynas, +fra1/jyzhao'
    FastStartFailoverTarget         = ''
    InconsistentProperties          = '(monitor)'
    InconsistentLogXptProps         = '(monitor)'
    SendQEntries                    = '(monitor)'
    LogXptStatus                    = '(monitor)'
    RecvQEntries                    = '(monitor)'
    ApplyLagThreshold               = '0'
    TransportLagThreshold           = '0'
    TransportDisconnectedThreshold  = '30'
    SidName(*)
    StaticConnectIdentifier(*)
    StandbyArchiveLocation(*)
    AlternateLocation(*)
    LogArchiveTrace(*)
    LogArchiveFormat(*)
    TopWaitEvents(*)
    (*) - Please check specific instance for the property value

Database Status:
SUCCESS

DGMGRL> 

附一些常用的命令汇总:

show configuration;
show database jyzhao;
show database mynas;
show database verbose jyzhao;
show database verbose mynas;
show instance verbose jyzhao1 on database jyzhao;
show instance verbose jyzhao2 on database jyzhao;
show instance verbose jyzhao1 on database mynas;
show instance verbose jyzhao2 on database mynas;

这些常用命令的输出结果大家可以在自己的实验环境测试一下,我这里就不赘述了。

6.切换测试

我们配置DG Broker主要就是为了方便切换,在配置正确的环境中,只需要一条命令就可以switchover成功。
在dgmgrl下切换测试:

--一条命令完成switchover主备切换:
switchover to mynas;    

--一条命令完成switchover主备切回:
switchover to jyzhao; 

来看看实际DG Broker的强大功能,以主备切换为例:

[oracle@jyrac1 ~]$ dgmgrl sys/oracle
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production

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

Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> switchover to mynas;
Performing switchover NOW, please wait...
Operation requires a connection to instance "jyzhao2" on database "mynas"
Connecting to instance "jyzhao2"...
Connected.
New primary database "mynas" is opening...
Operation requires startup of instance "jyzhao1" on database "jyzhao"
Starting instance "jyzhao1"...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "mynas"

整个过程一条简单命令实现,这相当于我之前手工切换《Oracle 11g DG手工switchover切换标准化流程》做的所有功能。
有了配置正确的DG Broker,老板再也不用担心员工去switchover切换搞的手忙脚乱了哈~

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

本文永久更新链接地址http://www.linuxidc.com/Linux/2017-08/146330.htm

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款