Oracle出现 The Network Adapter could not establish the connection

错误截图如下

Oracle出现 The Network Adapter could not establish the connection

 

排障

首先确保你的Oracle实例和监听服务是开启的,如下

Oracle出现 The Network Adapter could not establish the connection

然后,产生问题的原因就是你的主机名写错了

解决

打开listener.ora文件

D:\SoftwareDevelopment\Oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora (具体看你的实际路径)

文件内容大致如下

# listener.ora Network Configuration File: D:\SoftwareDevelopment\Oracle\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
     (SID_DESC =
     (GLOBAL_DBNAME = orcl.168.6.168)
     (ORACLE_HOME = D:\SoftwareDevelopment\Oracle\product\11.2.0\dbhome_1)
     (SID_NAME = ORCL)
     )

    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = D:\SoftwareDevelopment\Oracle\product\11.2.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:D:\SoftwareDevelopment\Oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    )
  
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.6.168)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = D:\SoftwareDevelopment\Oracle

上面红色部分,host就是你的主机名,port就是端口,你可以自己配,但是登陆时一定要用这个文件中配置的HOST的实际值,也可以用电脑的计算机全名

 

如下图所示

使用配置文件中的指定值-OK

Oracle出现 The Network Adapter could not establish the connection

使用计算机全名-也OK

Oracle出现 The Network Adapter could not establish the connection

Oracle出现 The Network Adapter could not establish the connection