sitemap

RSS地图

收藏本站

设为首页

Oracle研究中心

当前位置:Oracle研究中心 > 产品DBA > Oracle DG >

【学习笔记】Oracle数据库11GR2 datagruad环境搭建BORKER详细案例

时间:2016-10-25 10:44   来源:Oracle研究中心   作者:HTZ   点击:

天萃荷净 Oracle研究中心学习笔记:分享一篇关于Oralce数据库11GR2 datagruad环境搭建BORKER详细案例。
公司所有的DG环境都用到了BROKER这个东西.今天我也在VM来测试一下这个玩意。不过听说在生产中用得比较少.不知道我们公司为什么全部上的这个东西。

测试环境:OS REDHAT 5.6 X86_64 ,DB 11.2.0.2

1.修改dg_broker_config_file参数


如果是在RAC环境中.这个把这个文件把到共享的存储上面.如果有ASM可以放到ASM中。
主库:
#这里跟官方给的名字有一点不一样htz1.dat这里官方要求是drc<db_uniqun_name>.dat.但是我这里也没有报错。
SQL> alter system set dg_broker_config_file1='/u01/app/oracle/oradata/htz/htz1.dat';

System altered.

SQL>
SQL> alter system set dg_broker_config_file2='/u01/app/oracle/oradata/htz/htz2.dat';

System altered.
备库:
SQL> alter system set dg_broker_config_file1='/u01/app/oracle/oradata/htz/htz1.dat';

System altered.

SQL> alter system set dg_broker_config_file2='/u01/app/oracle/oradata/htz/htz2.dat';

System altered.

2.启用BROKER


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

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

System altered.

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

[oracle@11g admin]$ dgmgrl
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 sys/oracle@htz
Connected.
#help是帮忙命令.这点做得很好.不像sqlplus中。
DGMGRL> help create

Creates a broker configuration

Syntax:

CREATE CONFIGURATION name> AS
PRIMARYDATABASEIS <databasename>
CONNECT IDENTIFIER IS <connect identifier>;
#创建一个配置文件.这里一定要记得是连接到当前的主数据库
DGMGRL> create configuration htz asprimarydatabaseis htz connect identifier is htz;
Configuration "htz" created withprimarydatabase"htz"
#启用配置文件
DGMGRL> enable configuration;
Enabled.
#增加备库到配置文件中
DGMGRL> help add

Adds a standby databaseto the broker configuration

Syntax:

ADDDATABASE <databasename>
[ASCONNECT IDENTIFIER IS <connect identifier>]
[MAINTAINED AS {PHYSICAL|LOGICAL}];

DGMGRL> adddatabase htzb asconnect identifier is htzb;
Database"htzb" added
#启用备库
DGMGRL> enable database htzb;
Enabled.
#查看配置文件
DGMGRL> show configuration

Configuration - htz

Protection Mode: MaxAvailability
Databases:
htz - Primarydatabase
htzb - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS
#查看某个数据库的配置消息.其中很多参数我们都可以在sqlplus修改的。
DGMGRL> show database verbose htz;

Database - htz

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

Properties:
DGConnectIdentifier = 'htz'
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 = 'MANUAL'
ArchiveLagTarget = '0'
LogArchiveMaxProcesses = '4'
LogArchiveMinSucceedDest = '1'
DbFileNameConvert = '/u01Oracleoracleplus.net/app/oracle/oradata/htz/, /u01/app/oracle/oradata/htz/'
LogFileNameConvert = '/u01/app/oracle/oradata/htz/, /u01/app/oracle/oradata/htz/'
FastStartFailoverTarget = ''
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
SidName = 'htz'
#这里要注意了。broker里面的连接的service_name是_DGMGRL,因为我们
#静态监听中的GLOBAL_NAME是DB_UNIQUE_NAME.所以这里我们要修改
StaticConnectIdentifier #不然在切换的时候会报错的。

StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=11g)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=HTZ_DGMGRL)(INSTANCE_NAME=htz)(SERVER=DEDICATED)))'
StandbyArchiveLocation = '/u01/app/oracle/arch/htz/'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = '%t_%s_%r.dbf'
TopWaitEvents = '(monitor)'

Database Status:
SUCCESS

DGMGRL> show database verbose htzb;

Database - htzb

Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds
Apply Lag: 0 seconds
RealTime Query: ON
Instance(s):
htz

Properties:
DGConnectIdentifier = 'htzb'
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 = 'MANUAL'
ArchiveLagTarget = '0'
LogArchiveMaxProcesses = '4'
LogArchiveMinSucceedDest = '1'
DbFileNameConvert = '/u01/app/oracle/oradata/htz/, /u01/app/oracle/oradata/htz/'
LogFileNameConvert = '/u01/app/oracle/oradata/htz/, /u01/app/oracle/oradata/htz/'
FastStartFailoverTarget = ''
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
SidName = 'htz'
StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=11gdg)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=HTZB_DGMGRL)(INSTANCE_NAME=htz)(SERVER=DEDICATED)))'
StandbyArchiveLocation = '/u01/app/oracle/arch/htz/'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = '%t_%s_%r.dbf'
TopWaitEvents = '(monitor)'

Database Status:
SUCCESS


修改StaticConnectIdentifier参数.记得两个数据库都要修改。

DGMGRL> edit database htz set property StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.30)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=htz)(INSTANCE_NAME=htz)(SERVER=DEDICATED)))';
Property "staticconnectidentifier" updated
DGMGRL> edit database htzb set property StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.31)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=htzb)(INSTANCE_NAME=htz)(SERVER=DEDICATED)))';
Property "staticconnectidentifier" updated

开始切换:

DGMGRL> show configuration

Configuration - htz

Protection Mode: MaxAvailability
Databases:
#注意这里hta是主数据库
htz - Primary database
htzb - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS
#开始切换
DGMGRL> switchover to htzb;
Performing switchover NOW, please wait...
New primary database "htzb" is opening...
Operation requires shutdown of instance "htz" on database "htz"
Shutting down instance "htz"...
ORACLE instance shut down.
Operation requires startup of instance "htz" on database "htz"
Starting instance "htz"...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "htzb"
#查看状态
DGMGRL> show configuration;

Configuration - htz

Protection Mode: MaxAvailability
Databases:
#htzb已经切换成主数据库了.切换成功
htzb - Primary database
htz - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

本文固定链接: http://www.htz.pw/2014/06/18/11gr2-datagruad-%e7%8e%af%e5%a2%83%e6%90%ad%e5%bb%baborker-2.html | 认真就输


       

--------------------------------------ORACLE-DBA----------------------------------------

最权威、专业的Oracle案例资源汇总之【学习笔记】Oracle数据库11GR2 datagruad环境搭建BORKER详细案例

本文由大师惜分飞原创分享,网址:http://www.oracleplus.net/arch/1061.html

Oracle研究中心

关键词:

BORKER配置案例

11GR2 datagruad环境搭建BORKER

在VM测试11GR2 datagruad