博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ORA-12514: TNS:listener does not currently know of service requested in connect
阅读量:6413 次
发布时间:2019-06-23

本文共 6033 字,大约阅读时间需要 20 分钟。

1,登录报错如下:

[oracle@oracle_yueworld admin]$ rlwrap sqlplus system/system51@st1SQL*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 statusLSNRCTL 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地址:

,未经过运行,不得转载


3,去查看下参数

SQL> show parameter name;NAME                     TYPE    VALUE------------------------------------ ----------- ------------------------------db_file_name_convert             string  /oracle/app/oracle/oradata/pow                         erdes, /oracle/app/oracle/orad                         ata/orcldb_name                  string  orcldb_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 startLSNRCTL 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@st1SQL*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_nameLISTENER = (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@st1SQL*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>

转载于:https://www.cnblogs.com/jianglaoda/p/9184371.html

你可能感兴趣的文章
SSL协议详解
查看>>
leetcode-496-Next Greater Element I
查看>>
Android Studio自带的抓图和录像功能
查看>>
教妹学 Java:动态伴侣 Groovy
查看>>
第三周作业
查看>>
对象.原型链,函数.原型对象
查看>>
动态 K th
查看>>
MVC 中引入Jquery文件的几种方法
查看>>
servlet容器开发要点
查看>>
Idea debugger 无法启动-unable to open debugger port , java.net.SocketException "socket closed"
查看>>
100c之54: 说谎族,诚实族和两面族
查看>>
[转载]使用Cufon技术实现Web自定义字体
查看>>
c#获取电脑硬件信息参数说明( Win32_PhysicalMedia )
查看>>
9.Java通过axis调用WebService
查看>>
7. Spring Boot 启动加载数据 CommandLineRunner
查看>>
请问两个div之间的上下距离怎么设置
查看>>
java 使用反射
查看>>
20181204-2 Final发布
查看>>
性能测试初学_loadrunner脚本增强
查看>>
办公室局域网访问共享文件夹
查看>>