rac11g错误:远程连接报错:ORA-12545: 因目标主机或对象不存在, 连接失败

简介: 描述:刚搭建起来的rac环境,通过监听连接:sqlplus system/oracle@11grac 发现报了如下错误:ORA-12545: 因目标主机或对象不存在, 连接失败查看两个节点的tnsnames.

描述:

刚搭建起来的rac环境,通过监听连接:sqlplus system/oracle@11grac 发现报了如下错误:

ORA-12545: 因目标主机或对象不存在, 连接失败


查看两个节点的tnsnames.ora 信息如下:

11grac =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = test)
    )
  )


分别在两个节点查看参数文件信息:

rac1:

SQL> show parameter listener
NAME      TYPE  VALUE
------------------------------------ ----------- ------------------------------
listener_networks      string
local_listener      string  (DESCRIPTION=(ADDRESS_LIST=(AD
 DRESS=(PROTOCOL=TCP)(HOST=rac1
 -vip)(PORT=1521))))
remote_listener       string  rac-scan:1521


rac2:

SQL> show parameter listener
NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
listener_networks     string
local_listener     string (DESCRIPTION=(ADDRESS_LIST=(AD
DRESS=(PROTOCOL=TCP)(HOST=rac2
-vip)(PORT=1521))))
remote_listener     string rac-scan:1521

看到以上信息后,肯定第一步确定了我现在系统的hosts文件,确保rac-scan对应的ip地址存在。

然后尝试tnsping 11grac,发现可以通。因为tnsping只检查IP地址和端口是否能连通,至于数据库实例状态,监听注册了哪些服务这些,它是不检查的.


查看SCAN Listener 的状态:

[grid@rac1 admin]$ lsnrctl status LISTENER_SCAN1
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 24-OCT-2014 11:00:04
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_SCAN1
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                24-OCT-2014 10:51:50
Uptime                    0 days 0 hr. 8 min. 13 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/11.2.0/grid/log/diag/tnslsnr/rac1/listener_scan1/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.15.120)(PORT=1521)))
Services Summary...
Service "test" has 2 instance(s).
  Instance "test1", status READY, has 1 handler(s) for this service...
  Instance "test2", status READY, has 1 handler(s) for this service...
Service "testXDB" has 2 instance(s).
  Instance "test1", status READY, has 1 handler(s) for this service...
  Instance "test2", status READY, has 1 handler(s) for this service...
The command completed successfully

以上看来,是正常状态。


[grid@rac1 admin]$ lsnrctl service LISTENER_SCAN1


LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 24-OCT-2014 11:03:53
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
Services Summary...
Service "test" has 2 instance(s).
 
Instance "test1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready

         REMOTE SERVER
         (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1-vip)(PORT=1521)))
  Instance "test2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready

         REMOTE SERVER
         (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac2-vip)(PORT=1521)))
Service "testXDB" has 2 instance(s).
  Instance "test1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: rac1.lyg.com, pid: 5968>
         (ADDRESS=(PROTOCOL=tcp)(HOST=rac1.lyg.com)(PORT=26672))
  Instance "test2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: rac2.lyg.com, pid: 6006>
         (ADDRESS=(PROTOCOL=tcp)(HOST=rac2.lyg.com)(PORT=54390))
The command completed successfully

以上状态,正常。


手工尝试关闭rac2节点的监听:

[grid@rac2 ~]$ lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 24-OCT-2014 11:09:42
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
The command completed successfully
[grid@rac2 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 24-OCT-2014 11:09:49
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 2: No such file or directory
[grid@rac2 ~]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.DATA.dg    ora....up.type ONLINE    ONLINE    rac1        
ora.FRA.dg     ora....up.type ONLINE    ONLINE    rac1        
ora....ER.lsnr ora....er.type ONLINE    ONLINE    rac1        
ora....N1.lsnr ora....er.type ONLINE    ONLINE    rac1        
ora....VOTE.dg ora....up.type ONLINE    ONLINE    rac1        
ora.asm        ora.asm.type   ONLINE    ONLINE    rac1        
ora.eons       ora.eons.type  ONLINE    ONLINE    rac1        
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE               
ora....network ora....rk.type ONLINE    ONLINE    rac1        
ora.oc4j       ora.oc4j.type  OFFLINE   OFFLINE               
ora.ons        ora.ons.type   ONLINE    ONLINE    rac1        
ora....SM1.asm application    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    OFFLINE   OFFLINE               
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   ora....t1.type ONLINE    ONLINE    rac1        
ora....SM2.asm application    ONLINE    ONLINE    rac2        
ora....C2.lsnr application    OFFLINE   OFFLINE               
ora.rac2.gsd   application    OFFLINE   OFFLINE               
ora.rac2.ons   application    ONLINE    ONLINE    rac2        
ora.rac2.vip   ora....t1.type ONLINE    ONLINE    rac2        
ora....ry.acfs ora....fs.type ONLINE    ONLINE    rac1        
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    rac1        
ora.test.db    ora....se.type ONLINE    ONLINE    rac1


此时,可以看到rac2节点的监听服务已经关闭了。再次查看SCAN Listener的状态:

[grid@rac1 admin]$ lsnrctl service LISTENER_SCAN1
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 24-OCT-2014 11:16:28
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
Services Summary...
Service "test" has 2 instance(s).
  Instance "test1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         REMOTE SERVER
         (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1-vip)(PORT=1521)))
  Instance "test2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:blocked

         REMOTE SERVER
         (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac2-vip)(PORT=1521)))
Service "testXDB" has 2 instance(s).
  Instance "test1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: rac1.lyg.com, pid: 5968>
         (ADDRESS=(PROTOCOL=tcp)(HOST=rac1.lyg.com)(PORT=26672))
  Instance "test2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: rac2.lyg.com, pid: 6006>
         (ADDRESS=(PROTOCOL=tcp)(HOST=rac2.lyg.com)(PORT=54390))
The command completed successfully

可以看到此时的rac2节点的监听已经是blocked状态。此时,我们再尝试从rac2节点上去连接看看:

[oracle@rac2 ~]$ sqlplus system/oracle@TEST
SQL*Plus: Release 11.2.0.1.0 Production on Fri Oct 24 11:18:35 2014
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
ERROR:
ORA-28002: the password will expire within 6 days
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> show parameter instance_name;


NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
instance_name     string test1

可以看到,此时连接,已经体现了rac的故障切换功能。自动的连接到了实例1上。。。


原因是由于 Oracle会把local_listener注册到remote_listener(66/69)上,由于没有设置local_listener,默认就是"(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=1521)))"

当client尝试连接66/69时,有一定机会返回 "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=1521)))"给client ,让client转向,而client不认识 HOST=hostname,造成 12545
相关文章
|
Oracle 关系型数据库 Shell
|
1月前
|
存储 Oracle 关系型数据库
Oracle RAC:数据库集群的舞动乐章
【4月更文挑战第19天】Oracle RAC是Oracle提供的高可用性数据库解决方案,允许多个实例共享同一数据库,确保业务连续性和数据完整性。通过集群件和全局缓存服务实现服务器间的协调和通信。RAC提供高可用性,通过故障转移应对故障,同时提升性能,多个实例并行处理请求。作为数据管理员,理解RAC的架构和管理至关重要,以发挥其在数据管理中的最大价值。
|
1月前
|
存储 运维 Oracle
Oracle系列十八:Oracle RAC
Oracle系列十八:Oracle RAC
|
1月前
|
Oracle 关系型数据库
oracle Hanganalyze no RAC
oracle Hanganalyze no RAC
18 0
|
1月前
|
Oracle 关系型数据库
oracle rac 手工安装补丁,不适用auto
oracle rac 手工安装补丁,不适用auto
33 3
|
8月前
|
Oracle 关系型数据库 Java
分享一个 Oracle RAC 模式下客户端建立JDBC初始连接时因ONS造成应用启动时卡顿30秒问题的排查分析案例
分享一个 Oracle RAC 模式下客户端建立JDBC初始连接时因ONS造成应用启动时卡顿30秒问题的排查分析案例
|
存储 Oracle 关系型数据库
|
文字识别 Oracle 关系型数据库
Oracle rac重新执行root.sh脚本
Oracle rac重新执行root.sh脚本
736 0
|
网络协议 Oracle 关系型数据库
Oracle rac 修改SCAN IP
Oracle rac 修改SCAN IP
682 0