TNS-12564: TNS:connection refused

陆昊
2023-12-01

今天搭建DG的时候,一直报下面的错误:


 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oradevdb1.800best.com)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SID_NAME=orauat1s)(CID=(PROGRAM=oracle)(HOST=oradevdb2.800best.com)(USER=oracle))))

  VERSION INFORMATION:
        TNS for Linux: Version 11.2.0.3.0 - Production
        TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.3.0 - Production
  Time: 26-JUN-2015 14:12:35
  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

orauat1s =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oradevdb2.800best.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID_NAME = orauat1s)
    )
  )


查来查去原来是 tns 连接 里面的HOST指向 本机(oradevdb2.800best.com),并且我在/etc/hosts里面做了域名解析,这样tnsping的时候肯定能通,但是并不能保证tnsnames.ora 里面的service_name 和 sid 是正确 。将主机名改成oradevdb1.800best.com ,问题解决了


[oracle@oradevdb2 admin]$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

10.45.26.103 oradevdb1.800best.com
10.45.26.104 oradevdb2.800best.com


出现这种情况,网上有很多说法,有人说密码文件的问题,如果是密码文件的问题,一般会报 权限的错误。

 类似资料: