共计 5578 个字符,预计需要花费 14 分钟才能阅读完成。
这篇文章主要介绍了 DG Broker 如何搭建,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让丸趣 TV 小编带着大家一起了解一下。
DG Broker 搭建
1. 环境说明
databasesid db_name db_unique_namenet service nameprimary oggoggoggogg_pphysical standbydoggoggdoggdogg_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;
感谢你能够认真阅读完这篇文章,希望丸趣 TV 小编分享的“DG Broker 如何搭建”这篇文章对大家有帮助,同时也希望大家多多支持丸趣 TV,关注丸趣 TV 行业资讯频道,更多相关知识等着你来学习!