DGMGRL>show database verbose anxinstd; Database - anxinstd Role: PHYSICAL STANDBY Intended State: APPLY-ON Transport Lag: 0 seconds (computed 1second ago) Apply Lag: 0 seconds (computed 1second ago) Apply Rate: 54.00 KByte/s RealTime Query: ON Instance(s): anxinstd Warning: ORA-16714: the valueof property ArchiveLagTarget is inconsistent with the database setting Warning: ORA-16714: the valueof property LogArchiveMinSucceedDest is inconsistent with the database setting Warning: ORA-16714: the valueof property LogArchiveTrace is inconsistent with the database setting Warning: ORA-16714: the valueof property LogArchiveFormat is inconsistent with the database setting
......
此时主备alert日志均有报错 Fatal NI connect error 12514, connecting to:
DGMGRL> SWITCHOVER TO anxinstd; Performing switchover NOW, please wait... Operation requires a connection to instance "anxinstd" on database "anxinstd" Connecting to instance "anxinstd"... Unable toconnectto database ORA-12514: TNS:listener does not currently know of service requested inconnect descriptor Failed. Warning: You areno longer connected to ORACLE. connectto instance "anxinstd" of database "anxinstd"
官方文档中有如下描述:
1 2 3 4 5
After performing a switchover using DGMGRL, Data Guard requires a shutdown and startup of both the primary and standby databases. This issue can occur if any necessary entry is missing in the listener.ora file. DGMGRL is unable to connect to the database after it has been stopped while performing the switchover
To enable DGMGRL to restart instances during the course of broker operations, a service with a specific name must be statically registered with the listener of each instance. The value for the GLOBAL_DBNAME attribute must be set to a concatenation of db_unique_name_DGMGRL.db_domain in the LISTENER.ORA file.
再次测试,问题依旧,莫非和之前alert里的 Fatal NI connect error 12514报错有关?错误信息里的链接描述符均去请求一个db_unique_name_DGB.db_domain的服务,那么再依样添加到静态注册里试试
1 2 3 4 5 6 7 8 9 10 11 12
DGMGRL> switchover to anxinstd; Performing switchover NOW, please wait... Operation requires a connection to instance "anxinstd" on database "anxinstd" Connecting to instance "anxinstd"... Connected. Newprimary database "anxinstd" is opening... Operation requires startup of instance "anxin" on database "anxin" Starting instance "anxin"... ORACLE instance started. Database mounted. Database opened. Switchover succeeded, newprimaryis "anxinstd"
成功了,那么这个db_unique_name_DGB.db_domain的服务究竟是做什么用的呢?
{db_unique_name}_DGB.{db_domain}: This Service is used by the DMON-Processes to communicate between each other DMON是一个用来管理broker的后台进程,这个进程负责与本地数据库以及远程数据库的DMON进程进行通讯(与远端数据库的DMON进程进行通讯的时候使用的是一个 动态注册 的service name “db_unique_name_DGB.db_domain”)
既然是动态注册,那缘何注册失败呢? 文档 ID 365314.1给出了答案:Database Will Not Register With Listener configured on IP instead of Hostname
由此可见监听配置里还是采用hostname为好,通过本次事件也解惑了萦绕我心头很久的问题,很多时候建库完毕,使用工具创建动态注册的监听,监听状态里会有很多XDB之类的服务,而我改成静态监听之后(每次都用IP)却没有了之前的自动注册的服务,可见这就是根本原因:Database Will Not Register With Listener configured on IP instead of Hostname