暂无图片
暂无图片
3
暂无图片
暂无图片
暂无图片

DG Broker 遇到 ORA-12545: Connect failed because target host or object does not exist

原创 lps 2023-02-09
1987

[[toc]]

适用范围

ORACLE 11g DG Broker 切换报ORA-12545

问题概述

ORACLE RAC 到单机 DG Broker 配置与切换 的切换过程中遇到 ORA-12545: Connect failed because target host or object does not exist 具体报错如下:

DGMGRL> switchover to rac11g; Performing switchover NOW, please wait... Operation requires a connection to instance "rac11g1" on database "rac11g" Connecting to instance "rac11g1"... Connected. New primary database "rac11g" is opening... Operation requires startup of instance "RAC11GDG" on database "rac11gdg" Starting instance "RAC11GDG"... Unable to connect to database ORA-12545: Connect failed because target host or object does not exist Failed. Warning: You are no longer connected to ORACLE. Please complete the following steps to finish switchover: start up instance "RAC11GDG" of database "rac11gdg"

问题原因

DG Broker 中的staticConnectidentifier 配置为hostname,主库无法解析此 hostname,导致无法连接。

处理过程

检查 rac11gdg 详细信息

DGMGRL> show database verbose rac11gdg Database - rac11gdg Role: PHYSICAL STANDBY Intended State: APPLY-ON Transport Lag: (unknown) Apply Lag: (unknown) Apply Rate: (unknown) Real Time Query: OFF Instance(s): RAC11GDG Properties: DGConnectIdentifier = 'rac11gdg_rac11g' 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 = '600' LogArchiveMaxProcesses = '4' LogArchiveMinSucceedDest = '1' DbFileNameConvert = '' LogFileNameConvert = '' FastStartFailoverTarget = '' InconsistentProperties = '(monitor)' InconsistentLogXptProps = '(monitor)' SendQEntries = '(monitor)' LogXptStatus = '(monitor)' RecvQEntries = '(monitor)' ApplyLagThreshold = '0' TransportLagThreshold = '0' TransportDisconnectedThreshold = '30' SidName = 'RAC11GDG' StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dgbrok)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=RAC11GDG_DGMGRL)(INSTANCE_NAME=RAC11GDG)(SERVER=DEDICATED)))' StandbyArchiveLocation = '/oradg' AlternateLocation = '' LogArchiveTrace = '0' LogArchiveFormat = '%t_%s_%r.dbf' TopWaitEvents = '(monitor)' Database Status: DGM-17016: failed to retrieve status for database "rac11gdg" ORA-12514: TNS:listener does not currently know of service requested in connect descriptor ORA-16625: cannot reach database "rac11gdg"

可以看到在最后报无法连接rac11gdg,检查上面的信息发现

StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dgbrok)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=RAC11GDG_DGMGRL)(INSTANCE_NAME=RAC11GDG)(SERVER=DEDICATED)))'

StaticConnectIdentifier中的 HOST 写的是hostname,而在主服务器是无法解析此hostname的。

检查 rac11g 数据库alert 日志发现如下,提示无法连接

*********************************************************************** Fatal NI connect error 12514, connecting to: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.8.8.201)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=rac11gdg_DGB)(CID=(PROGRAM=oracle)(HOST=11g-node1)(USER=grid)))) 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: 08-FEB-2023 10:22:56 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

回切过程的提示为:

Please complete the following steps to finish switchover: start up instance "RAC11GDG" of database "rac11gdg"

要完成接下来的切换,需要去启动RAC11GDG,接下来手动启动 RAC11GDG ,查看 DG Broker 状态

DGMGRL> show configuration; Configuration - dgbrok Protection Mode: MaxPerformance Databases: rac11g - Primary database rac11gdg - Physical standby database Fast-Start Failover: DISABLED Configuration Status: ORA-16610: command "SWITCHOVER TO rac11gdg" in progress DGM-17017: unable to determine configuration status

可以看到 SWITCHOVER 操作正在执行,无法查看状态,过1-2分钟继续查看,恢复正常。

DGMGRL> show configuration; Configuration - dgbrok Protection Mode: MaxPerformance Databases: rac11g - Primary database rac11gdg - Physical standby database Fast-Start Failover: DISABLED Configuration Status: SUCCESS DGMGRL>

首先,手动启动rac11gdg库,会自动回复正常。

那为什么会出现 ORA-12545呢,通过上面的日志可以查看,日志报的连接 172.8.8.201SERVICE_NAME=rac11gdg_DGB 无法连接,我们知道,_DGB 服务是在数据库启动之后动态注册的,目前数据库是关闭的,DGMGRL 切换提示的是启动数据库过程中失败,无法连接数据库

Starting instance "RAC11GDG"... Unable to connect to database ORA-12545: Connect failed because target host or object does not exist

那这个连接数据库启动数据库是通过 RAC11GDG_DGMGRL服务连接的,也就是 RAC11GDG_DGMGRL 服务无法连接,_DGMGRL 的连接配置是在 StaticConnectIdentifier 里的,通过查 StaticConnectIdentifier 配置的 host 是主机名称。但是在主库上是无法解析这个主机名称的,所以只要能让主库能解析道这个主机名称即可,所以方案有2个如下:

解决方案

1、修改/etc/hosts ,将 iphostname 写入 /etc/hosts;
或者
2、DGMGRL 中 staticConnectidentifier 中的 HOST 修改为ip地址。
命令类似如下:

DGMGRL> edit database rac11gdg set property staticConnectidentifier ='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8.201)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=rac11gdg_DGMGRL)(INSTANCE_NAME=rac11gdg)(SERVER=DEDICATED)))';
最后修改时间:2023-02-09 17:44:27
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论