Oracle11g,报错代码为:ORA-12514:监听程序当前无法识别连接描述符中请求的服务。

出现该问题一般有两种情况。

第一种是在你安装完之后未配置监听(在此我暂时忘记安装完之后有没有配置监听);
第二种是之前配置了监听但是系统未写入到listener.ora文件中(在此我暂未搞明白什么时候写入,并且有些未写入也可以用但是我配置完这些后的确可以用了,不理解但祝福),所以只需要在该文件中写入配置参数就可以了。

修改listener.ora

原listener.ora文件

# listener.ora Network Configuration File: C:\software\Oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\software\Oracle\product\11.2.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:C:\software\Oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.131.128)(PORT = 1521))
    )
  )
ADR_BASE_LISTENER = C:\software\Oracle

从上图中我们可以看出我已经配置过监听了,但是报错是由于Oracle的地址没有写到SID_DESC中,在此我们将此写入就可以了。

添加 记录

	(SID_DESC =
      (GLOBAL_DBNAME = orcl)
      (ORACLE_HOME = C:\software\Oracle\product\11.2.0\dbhome_1)
      (SID_NAME = orcl)
     )

修改后listener.ora文件

# listener.ora Network Configuration File: C:\software\Oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\software\Oracle\product\11.2.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:C:\software\Oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    )
	(SID_DESC =
      (GLOBAL_DBNAME = orcl)
      (ORACLE_HOME = C:\software\Oracle\product\11.2.0\dbhome_1)
      (SID_NAME = orcl)
     )
  )
  
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.131.128)(PORT = 1521))
    )
  )
ADR_BASE_LISTENER = C:\software\Oracle




tnsnames.ora

原tnsnames.ora文件

# tnsnames.ora Network Configuration File: C:\software\Oracle\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.131.128)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )


修改tnsnames.ora数据

已标黄,就修改了地址。

ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost )(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)

修改后tnsnames.ora文件

# tnsnames.ora Network Configuration File: C:\software\Oracle\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.


LISTENER_ORCL =
  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))



ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost )(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )


Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐