说明
最近碰到一个 dg_broker 的问题,按照文档一步步配置,enable configuration 后,备库死活连不上,但 DG 同步状态正常。下面是具体的配置步骤:
1. DG 配置
这里忽略 DG 的配置过程,各位可以网上搜搜。
2. dg broker需要的相关信息
2.1 listener.ora
2.1.1 primary db
[oracle@tydb009 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 14-8月 -2023 16:45:16
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.22)(PORT=1600)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 18-5月 -2023 14:31:30
Uptime 88 days 2 hr. 13 min. 45 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/tydb009/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.10.22)(PORT=1600)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl_DGMGRL" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@tydb009 admin]$ cat listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = orcl)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.22)(PORT = 1600))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1600))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
2.1.2 standby db
[oracle@tydb012 admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 28-8月 -2023 14:05:23
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.24)(PORT=1600)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 28-8月 -2023 13:51:18
Uptime 0 days 0 hr. 14 min. 5 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/tydb012/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.10.24)(PORT=1600)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1600)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl_DGMGRL" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@tydb012 admin]$ cat listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = orcl)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.24)(PORT = 1600))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1600))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
2.2 tnsnames.ora
2.2.1 primary db
[oracle@tydb009 admin]$ cat tnsnames.ora
orcl =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.22)(PORT = 1600))
)
(CONNECT_DATA =
(SID = orcl)
)
)
orcl_dg =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.24)(PORT = 1600))
)
(CONNECT_DATA =
(SID = orcl)
)
)
2.2.2 standby db
[oracle@tydb012 admin]$ cat tnsnames.ora
orcl =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.22)(PORT = 1600))
)
(CONNECT_DATA =
(SID = orcl)
)
)
orcl_dg =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.24)(PORT = 1600))
)
(CONNECT_DATA =
(SID = orcl)
)
)
当前 DG 同步状态正常,下面开始配置 dg broker
3. dg broker 配置
3.1 修改主备 dg_broker 参数
# primary
alter system set dg_broker_start=true scope=both;
show parameter dg_broker
System altered.
SQL>
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
dg_broker_config_file1 string /u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr1orcl.dat
dg_broker_config_file2 string /u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr2orcl.dat
dg_broker_start boolean TRUE
# standby
SQL> alter system set dg_broker_start=true scope=both;
show parameter dg_broker
System altered.
SQL>
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
dg_broker_config_file1 string /u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr1orcl_dg.dat
dg_broker_config_file2 string /u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr2orcl_dg.dat
dg_broker_start boolean TRUE
3.2 配置 dg_broker
[oracle@tydb009 ~]$ dgmgrl /
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> create configuration 'dg_orcl' as primary database is 'orcl' connect identifier is orcl;
Configuration "dg_orcl" created with primary database "orcl"
# 添加数据库
DGMGRL> add database 'orcl_dg' as connect identifier is 'orcl_dg' maintained as physical;
Database "orcl_dg" added
3.3 查看详细信息
show configuration
DGMGRL> show configuration
Configuration - dg_orcl
Protection Mode: MaxPerformance
Databases:
orcl - Primary database
orcl_dg - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
DISABLED
show database verbose orcl
DGMGRL> show database verbose orcl
Database - orcl
Role: PRIMARY
Intended State: OFFLINE
Instance(s):
orcl
Properties:
DGConnectIdentifier = 'orcl'
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/orcl, /u01/app/oracle/oradata/orcl'
LogFileNameConvert = '/u01/app/oracle/oradata/orcl, /u01/app/oracle/oradata/orcl'
FastStartFailoverTarget = ''
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
ApplyLagThreshold = '0'
TransportLagThreshold = '0'
TransportDisconnectedThreshold = '30'
SidName = 'orcl'
StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.10.22)(PORT=1600))(CONNECT_DATA=(SERVICE_NAME=orcl_DGMGRL)(INSTANCE_NAME=orcl)(SERVER=DEDICATED)))'
StandbyArchiveLocation = '/u01/app/archive'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = '%t_%s_%r.dbf'
TopWaitEvents = '(monitor)'
Database Status:
DISABLED
show database verbose orcl_dg
DGMGRL> show database verbose orcl_dg
Database - orcl_dg
Role: PHYSICAL STANDBY
Intended State: OFFLINE
Transport Lag: (unknown)
Apply Lag: (unknown)
Apply Rate: (unknown)
Real Time Query: OFF
Instance(s):
orcl
Properties:
DGConnectIdentifier = 'orcl_dg'
ObserverConnectIdentifier = ''
LogXptMode = 'SYNC'
DelayMins = '0'
Binding = 'OPTIONAL'
MaxFailure = '0'
MaxConnections = '1'
ReopenSecs = '30'
NetTimeout = '15'
RedoCompression = 'DISABLE'
LogShipping = 'ON'
PreferredApplyInstance = ''
ApplyInstanceTimeout = '0'
ApplyParallel = 'AUTO'
StandbyFileManagement = 'AUTO'
ArchiveLagTarget = '0'
LogArchiveMaxProcesses = '4'
LogArchiveMinSucceedDest = '1'
DbFileNameConvert = '/u01/app/oracle/oradata/orcl, /u01/app/oracle/oradata/orcl'
LogFileNameConvert = '/u01/app/oracle/oradata/orcl, /u01/app/oracle/oradata/orcl'
FastStartFailoverTarget = ''
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
ApplyLagThreshold = '0'
TransportLagThreshold = '0'
TransportDisconnectedThreshold = '30'
SidName = 'orcl'
StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.10.24)(PORT=1600))(CONNECT_DATA=(SERVICE_NAME=orcl_DGMGRL)(INSTANCE_NAME=orcl)(SERVER=DEDICATED)))'
StandbyArchiveLocation = '/u01/app/archive'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = '%t_%s_%r.dbf'
TopWaitEvents = '(monitor)'
Database Status:
DISABLED
3.4 启动配置
DGMGRL> enable configuration
Enabled.
# 检查状态
DGMGRL> show configuration
Configuration - dg_orcl
Protection Mode: MaxPerformance
Databases:
orcl - Primary database
orcl_dg - Physical standby database
Error: ORA-16664: 无法从数据库接收结果
Fast-Start Failover: DISABLED
Configuration Status:
ERROR
DGMGRL> show database verbose orcl
Database - orcl
Role: PRIMARY
Intended State: TRANSPORT-ON
Instance(s):
orcl
Properties:
DGConnectIdentifier = 'orcl'
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/orcl, /u01/app/oracle/oradata/orcl'
LogFileNameConvert = '/u01/app/oracle/oradata/orcl, /u01/app/oracle/oradata/orcl'
FastStartFailoverTarget = ''
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
ApplyLagThreshold = '0'
TransportLagThreshold = '0'
TransportDisconnectedThreshold = '30'
SidName = 'orcl'
StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.10.22)(PORT=1600))(CONNECT_DATA=(SERVICE_NAME=orcl_DGMGRL)(INSTANCE_NAME=orcl)(SERVER=DEDICATED)))'
StandbyArchiveLocation = '/u01/app/archive'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = '%t_%s_%r.dbf'
TopWaitEvents = '(monitor)'
Database Status:
SUCCESS
DGMGRL> show database verbose orcl_dg
Database - orcl_dg
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: (unknown)
Apply Lag: (unknown)
Apply Rate: (unknown)
Real Time Query: OFF
Instance(s):
orcl
Properties:
DGConnectIdentifier = 'orcl_dg'
ObserverConnectIdentifier = ''
LogXptMode = 'SYNC'
DelayMins = '0'
Binding = 'OPTIONAL'
MaxFailure = '0'
MaxConnections = '1'
ReopenSecs = '30'
NetTimeout = '15'
RedoCompression = 'DISABLE'
LogShipping = 'ON'
PreferredApplyInstance = ''
ApplyInstanceTimeout = '0'
ApplyParallel = 'AUTO'
StandbyFileManagement = 'AUTO'
ArchiveLagTarget = '0'
LogArchiveMaxProcesses = '4'
LogArchiveMinSucceedDest = '1'
DbFileNameConvert = '/u01/app/oracle/oradata/orcl, /u01/app/oracle/oradata/orcl'
LogFileNameConvert = '/u01/app/oracle/oradata/orcl, /u01/app/oracle/oradata/orcl'
FastStartFailoverTarget = ''
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
ApplyLagThreshold = '0'
TransportLagThreshold = '0'
TransportDisconnectedThreshold = '30'
SidName = 'orcl'
StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.10.24)(PORT=1600))(CONNECT_DATA=(SERVICE_NAME=orcl_DGMGRL)(INSTANCE_NAME=orcl)(SERVER=DEDICATED)))'
StandbyArchiveLocation = '/u01/app/archive'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = '%t_%s_%r.dbf'
TopWaitEvents = '(monitor)'
Database Status:
DGM-17016: failed to retrieve status for database "orcl_dg"
ORA-16664: 无法从数据库接收结果这里
可以看到,在查看备库详细信息时,看到 错误:
DGM-17016: failed to retrieve status for database "orcl_dg"
ORA-16664: 无法从数据库接收结果这里
3.5 查看日志
# primary dg_broker log
Site orcl_dg returned ORA-16664.
Data Guard Broker Status Summary:
Type Name Severity Status
Configuration dg_orcl Warning ORA-16607
Primary Database orcl Success ORA-00000
Physical Standby Database orcl_dg Error ORA-16664
# standby dg_broker log
Failed to connect to remote database orcl. Error is ORA-12514
Failed to send message to site orcl. Error code is ORA-12514.
从提示来看,就是 primary db 和 standby db 互相不能连通,但是此时同步状态又是 OK 的,这里就很诡异了。
在看看主备库的 alter 日志
# primary alert log
没有什么错误提示
# standby alert log
Fatal NI connect error 12514, connecting to:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.22)(PORT=1600)))(CONNECT_DATA=(SERVICE_NAME=orcl_DGB)(INSTANCE_NAME=orcl)(CID=(PROGRAM=oracle)(HOST=tydb012)(USER=oracle))))
VERSION INFORMATION:
TNS for Linux: Version 11.2.0.4.0 - Production
TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.4.0 - Production
Time: 28-8月 -2023 14:32:03
Tracing not turned on.
Tns error struct:
ns main err code: 12564
TNS-12564: TNS:connection refused
ns secondary err code: 0
nt main err code: 0
nt secondary err code: 0
nt OS err code: 0
可以看到这里提示从主库进行连接的信息,service_name = orcl_DGB,但是在配置的时候,不管listener.ora 还是 tnsnames.ora 都没有配置 service_name=orcl_DGB 信息,奇了大怪了。
后来有重新配置了多次 listener.ora 和 tnsnames.ora ,用 sqlplus sys/xxx@orcl 或 sqlplus sys/xxx@orcl_dg 都能互相访问,但 db_broker 还是不行,都是一样连通问题。
因为提示的是 service_name 问题,所以重点分析监听,发现配置的监听只有静态监听,没有动态监听注册进来。
由于更改过端口,所以检查下 local_listener 参数
发现主备中 local_listener 参数是空,所以无法动态注册监听
SQL> show parameter local_lis
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string
修改 local_listener 参数
# 主备库修改 local_lisener 参数
alter system set local_listener="(address = (PROTOCOL = TCP)(HOST = 192.168.10.22) (PORT = 1600))";
alter system set local_listener="(address = (PROTOCOL = TCP)(HOST = 192.168.10.24) (PORT = 1600))";
查看监听
# primary db listener
[oracle@tydb009 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 14-8月 -2023 17:36:17
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.22)(PORT=1600)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 18-5月 -2023 14:31:30
Uptime 88 days 3 hr. 4 min. 46 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/tydb009/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.10.22)(PORT=1600)))
Services Summary...
Service "orcl" has 2 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl_DGB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl_DGMGRL" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
# standby listener
[oracle@tydb012 admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 28-8月 -2023 14:53:18
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.24)(PORT=1600)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 28-8月 -2023 13:51:18
Uptime 0 days 1 hr. 2 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/tydb012/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.10.24)(PORT=1600)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1600)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl_DGMGRL" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl_dg" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl_dg_DGB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
主备库动态注册 OK,再检查 dg_broker 状态
DGMGRL> show configuration
Configuration - dg_orcl
Protection Mode: MaxPerformance
Databases:
orcl - Primary database
orcl_dg - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESSDGMGRL> show database verbose orcl_dg
Database - orcl_dg
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: 36.00 KByte/s
Real Time Query: ON
Instance(s):
orcl
Properties:
DGConnectIdentifier = 'orcl_dg'
ObserverConnectIdentifier = ''
LogXptMode = 'SYNC'
DelayMins = '0'
Binding = 'OPTIONAL'
MaxFailure = '0'
MaxConnections = '1'
ReopenSecs = '30'
NetTimeout = '15'
RedoCompression = 'DISABLE'
LogShipping = 'ON'
PreferredApplyInstance = ''
ApplyInstanceTimeout = '0'
ApplyParallel = 'AUTO'
StandbyFileManagement = 'AUTO'
ArchiveLagTarget = '0'
LogArchiveMaxProcesses = '4'
LogArchiveMinSucceedDest = '1'
DbFileNameConvert = '/u01/app/oracle/oradata/orcl, /u01/app/oracle/oradata/orcl'
LogFileNameConvert = '/u01/app/oracle/oradata/orcl, /u01/app/oracle/oradata/orcl'
FastStartFailoverTarget = ''
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
ApplyLagThreshold = '0'
TransportLagThreshold = '0'
TransportDisconnectedThreshold = '30'
SidName = 'orcl'
StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.10.24)(PORT=1600))(CONNECT_DATA=(SERVICE_NAME=orcl_DGMGRL)(INSTANCE_NAME=orcl)(SERVER=DEDICATED)))'
StandbyArchiveLocation = '/u01/app/archive'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = '%t_%s_%r.dbf'
TopWaitEvents = '(monitor)'
Database Status:
SUCCESS
可以看到此时状态正常了
4. dg_broker swichover 测试
DGMGRL> switchover to orcl_dg
Performing switchover NOW, please wait...
Operation requires a connection to instance "orcl" on database "orcl_dg"
Connecting to instance "orcl"...
Connected.
New primary database "orcl_dg" is opening...
Operation requires startup of instance "orcl" on database "orcl"
Starting instance "orcl"...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "orcl_dg"
DGMGRL> show configuration
Configuration - dg_orcl
Protection Mode: MaxPerformance
Databases:
orcl_dg - Primary database
orcl - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
可以看到 primary database 切换成了 orcl_dg 了,说明已经切换完成
至此,问题解决,主要是监听的问题,因为没有动态注册造成。