Oracle11g “ORA-12514 监听程序当前无法识别连接描述符中请求的服务”的错误解决过程记录

1、安装环境

Windows7/Windows10/Windows Server 2012 R2

标准版/企业版

2、操作步骤

(1)按照安装流程完成安装;

(2)安装完成后,默认已经配置了一个服务orcl,一个监听程序Listener。服务主机名默认为localhost,Listener的监听位置地址主机默认为localhost,在Net Manager中测试服务,测试成功!

(3)既然是数据库服务,自然需要客户端来访问(生产环境下,自然是存在数据库服务器),那么我们服务的主机和监听程序的主机都应该采用网络IP来定义。OK,直接在Net Manager中修改,XXX.XXX.XXX.XXX。

(4)Next,根据Oracle官网的说法,Net Manager中的配置需要重启服务。OK,重启OracleOraDb11g_homeXTNSListener,顺手把OracleServiceORCL也重启下吧~~~

(5)测试服务,scott...然而,这次测试并不成功,错误:ORA-12514 监听程序当前无法识别连接描述符中请求的服务。

------------------------------------------------------------开始解决问题-------------------------------------------------  

  对于一位技术人,报错事件几乎每天都会触发,还可能递归100遍!!!

  所以勿须慌张,我们先来好好分析(不推荐直接“度娘”啊,搜出N个帖子论坛的解决方案,逐个试个遍,其实这种做法的大有人在。但每个人遇到的问题不尽相同,每台服务器的部署环境不尽相同,论坛帖子的作者在特定的环境下能解决,并不代表就一定能解决你的问题!当然,试下去能解决的概率还是挺大的,毕竟全球从业人员众多,一款大型的数据库软件的配置问题,遇到的人不胜其数)。

(1)首先,错误中指出是监听程序无法识别服务,那么我们先来弄清楚Oracle的监听程序与服务的关系:

在Oracle官方文档中有介绍:

The listener is a separate process that runs on the database server computer. It receives incoming client connection requests and manages the traffic of these requests to the database server. This chapter describes how to configure the listener to accept client connections.

AND

A listener is configured with one or more listening protocol addresses, information about supported services, and parameters that control its runtime behavior. The listener configuration is stored in a configuration file named listener.ora.

(2)从文档中可以看出监听程序的配置文件是listener.org,很容易能找到文件目录:安装目录\app\admin\product\11.2.0\dbhome_1\NETWORK\ADMIN

打开文件:

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

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

ADR_BASE_LISTENER = E:\app\admin

如果你是位Oracle技术牛人,对listener的所有配置参数都了如指掌,那应该很容易就解决问题了。但我也知道有很大一部分人,对这些配置文件并不感兴趣,配置出错,网上找找,解决OK,能用到N年后。

但我并不多了解Oracle,但要指导他人来解问题。这种情况下,推荐先在官网把listener的配置参数文档看一遍,相信这几分钟的事比在“度娘”搜查更高效率。

(3)遍历官方文档,可以瞄到线索了:

GLOBAL_DBNAME

Purpose

Use the parameter GLOBAL_DBNAME to identify the database service.

While processing a client connection request, the listener tries to match the value of this parameter with the value of the SERVICE_NAME parameter in the client connect descriptor. If the client connect descriptor uses the SID parameter, then the listener does not attempt to map the values. This parameter is primarily intended for configurations with Oracle8 release 8.0 or Oracle7 databases (where dynamic service registration is not supported for dedicated servers). This parameter may also be required for use with Oracle9i and Oracle8 database services by some configurations and management tools.

The value for this parameter is typically obtained from the combination of the DB_NAME and DB_DOMAIN parameters (DB_NAME.DB_DOMAIN) in the initialization parameter file, but the value can also contain any valid name used by clients to identify the service.

Embed this parameter under the SID_DESC parameter.

Example

SID_LIST_listener_name=
  (SID_LIST= 
   (SID_DESC=
    (GLOBAL_DBNAME=sales.us.example.com)
    (SID_NAME=sales)
    (ORACLE_HOME=/usr/oracle)))

从中我们可以知道,在客户端连接请求时,会存在一个连接描述,而SERVICE_NAME的值包含在连接描述中。而global_dbname是用来定义database service。再结合错误提示:监听程序无法识别连接描述符中请求的服务。可以推测,可能是服务未定义。
我们根据Example增加global_dbname进去,如下:

# listener.ora Network Configuration File: E:\app\admin\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)

(SID_NAME = ORCL)

(ORACLE_HOME = E:\app\admin\product\11.2.0\dbhome_1)
)
)

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

ADR_BASE_LISTENER = E:\app\admin

(4)重启Listener服务,测试成功!

虽然这可能是个小白问题,但也花费了时间去学习、去解决问题。

 
posted @ 2018-08-24 10:31  ShawnShao  阅读(10119)  评论(0编辑  收藏  举报