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服務,測試成功!

雖然這可能是個小白問題,但也花費了時間去學習、去解決問題。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM