ORA-12514: TNS:listener does not currently know of service requested in connect


1,登錄報錯如下:

[oracle@oracle_yueworld admin]$ rlwrap sqlplus system/system51@st1 SQL*Plus: Release 11.2.0.1.0 Production on Thu Dec 3 16:33:26 2015 Copyright (c) 1982, 2009, Oracle. All rights reserved. ERROR: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

2,查看下lsnrctl狀態,看是否是lsnrctl監聽的問題

[oracle@oracle_yueworld admin]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 03-DEC-2015 17:03:07 Copyright (c) 1991, 2009, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.121.51)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 03-DEC-2015 17:02:55 Uptime 0 days 0 hr. 0 min. 11 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Listener Log File /oracle/app/oracle/diag/tnslsnr/oracle_yueworld/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.121.51)(PORT=1521))) The listener supports no services The command completed successfully [oracle@oracle_yueworld admin]$ [oracle@oracle_yueworld admin]$ 

從中可以看出監聽正常,但是The listener supports no services這個貌似是不識別service_name啊

原blog地址:http://blog.csdn.net/mchdba/article/details/50166153
,未經過運行,不得轉載


3,去查看下參數

SQL> show parameter name;

NAME                     TYPE VALUE ------------------------------------ ----------- ------------------------------ db_file_name_convert string /oracle/app/oracle/oradata/pow erdes, /oracle/app/oracle/orad ata/orcl db_name string orcl db_unique_name string stunq global_names boolean FALSE instance_name string orcl lock_name_space string log_file_name_convert string service_names string stunq SQL> 

看到db_name和db_unique_name以及service_names不一樣


4,解決方案

在listener.ora文件里面添加SID_LIST_LISTENER,如下所示:

作用:以下紅色的模塊是靜態注冊監聽服務,方便客戶端遠程連接該數據庫使用


[oracle@oracle_yueworld admin]$ more listener.ora 
# listener.ora Network Configuration File: /oracle/app/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 = stunq) (ORACLE_HOME = /oracle/app/oracle/product/11.2.0/dbhome_1) (SID_NAME = stunq) ) ) LISTENER = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.121.51)(PORT = 1521)) ) ADR_BASE_LISTENER = /oracle/app/oracle [oracle@oracle_yueworld admin]$ 

再重啟lsnrctl服務:

[oracle@oracle_yueworld admin]$ lsnrctl start LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 03-DEC-2015 18:00:09 Copyright (c) 1991, 2009, Oracle. All rights reserved. Starting /oracle/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 11.2.0.1.0 - Production System parameter file is /oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Log messages written to /oracle/app/oracle/diag/tnslsnr/oracle_yueworld/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.121.51)(PORT=1521))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.121.51)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 03-DEC-2015 18:00:09 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora Listener Log File /oracle/app/oracle/diag/tnslsnr/oracle_yueworld/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.121.51)(PORT=1521))) Services Summary... Service "stunq" has 1 instance(s). Instance "stunq", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully [oracle@oracle_yueworld admin]$ 

看到The listener supports no services錯誤已經沒有了,可以去試試登錄


5,再次登錄報錯

[oracle@oracle_yueworld admin]$ rlwrap sqlplus  orclk/st141118@st1

SQL*Plus: Release 11.2.0.1.0 Production on Thu Dec 3 18:03:55 2015 Copyright (c) 1982, 2009, Oracle. All rights reserved. ERROR: ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist Linux-x86_64 Error: 2: No such file or directory Process ID: 0 Session ID: 0 Serial number: 0 Enter user-name: 

6,去修改服務端和客戶端的配置文件

google了很多資料,大部分都說是listener.ora配置錯誤導致listener找不到你要請求的sid。這有兩種可能,一種是client端的tnsnames.ora中配置了錯誤的SID,一種是server端的listener.ora中配置錯了SID。仔細檢查,然后開始修改服務器listener.ora listener.ora,將SID_NAME修改成正確的instance_name為orcl

[oracle@oracle_yueworld admin]$ more listener.ora 
# listener.ora Network Configuration File: /oracle/app/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 = stunq) (ORACLE_HOME = /oracle/app/oracle/product/11.2.0/dbhome_1) (SID_NAME = orcl) ) ) #PS: 這里面的SID_NAME是oracle實例名,GLOBAL_DBNAME是全局的dbname,是db_unique_name LISTENER = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.121.51)(PORT = 1521)) ) ADR_BASE_LISTENER = /oracle/app/oracle [oracle@oracle_yueworld admin]$ 

修改客戶端tnsnames.ora

[oracle@oracle_yueworld admin]$ vim tnsnames.ora # tnsnames.ora Network Configuration File: /oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. st1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.121.51)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = stunq) ) ) # PS:這里的service_name就是可以從執行 show parameter name;中顯示的service_names參數值。

7,然后驗證登錄,成功了,如下所示:

[oracle@oracle_yueworld admin]$ 
[oracle@oracle_yueworld admin]$  rlwrap sqlplus orclk/st141118@st1

SQL*Plus: Release 11.2.0.1.0 Production on Thu Dec 3 19:43:10 2015 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Release 11.2.0.1.0 - 64bit Production SQL> 


免責聲明!

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



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