今天使用SQL Developer连接一台测试服务器数据库(ORACLE 11g)时,遇到了“ORA-12514, TNS:listener does not currently know of service requested in connect descriptor”错误,具体提示如下所示:

执行请求的操作时遇到错误:

 

Listener refused the connection with the following error:

 

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

 

供应商代码 12514

几年前写过一篇关于”ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务“的案例文章,现在看来当时写的比较肤浅和粗糙,当然案例也不一样,下面在总结一下如何处理ORA-12514这个错误吧。

Step 1: 首先检查客户端的tnsnames.ora里面的host、port、service_name等是否正确

myvm =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.20.57.15)(PORT = 1521))

    )

    (CONNECT_DATA =

       (SERVER = SHARED)

      (SERVICE_NAME = gsp.localdomain)

      

    )

  )

逐一仔细检查过后发现这些配置都是正确的。 其实前几天还是正常来的。测试服务器和tnsnames.ora都没有改动过。所以我们继续后面排查。

 

Step 2:检查确认数据库实例是否启动。

SQL> select status from v$instance;

 

STATUS

------------

OPEN

 

SQL> 

如上所示,数据库实例正常,并没有关闭。当数据库实例异常关闭,也会出现ORA-12514错误,如下所示(如果我关闭一数据库实例,然后使用SQL*Plus测试连接数据库就会遇到这个错误):

C:\Users>sqlplus system/123456@mydb

 

SQL*Plus: Release 11.2.0.1.0 Production on 星期三 4月 12 11:56

 

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

 

ERROR:

ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务

 

Step 3:检查网络是否正常,tnsping能否ping通

如下所示,ping 和tnsping 均都正常

监听服务也正常,没有问题

[oracle@DB-Server admin]$ lsnrctl status

 

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 12-APR-2017 10:36:40

 

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production

Start Date                12-APR-2017 10:31:20

Uptime                    0 days 0 hr. 5 min. 20 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/oracle/product/11.1.0/dbhome_1/network/admin/listener.ora

Listener Log File         /u01/app/oracle/diag/tnslsnr/DB-Server/listener/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DB-Server.localdomain)(PORT=1521)))

The listener supports no services

The command completed successfully

Step 4:检查$ORACLE_BASE/diag/tnslsnr/DB-Server/listener/alert下的日志,发现host_addr为10.20.34.76,实际IP地址不是这个。因为监听文件里面我使用的hostname DB-Server.localdomain,所以赶紧检查/etc/hosts的配置

[root@DB-Server ~]# ifconfig

eth0      Link encap:Ethernet  HWaddr B0:83:FE:55:32:E5  

          inet addr:10.20.57.15  Bcast:10.20.57.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:2363981 errors:0 dropped:0 overruns:0 frame:0

          TX packets:180048 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:225925147 (215.4 MiB)  TX bytes:14349633 (13.6 MiB)

          Interrupt:233 Base address:0x4000 

 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:3692 errors:0 dropped:0 overruns:0 frame:0

          TX packets:3692 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:2982961 (2.8 MiB)  TX bytes:2982961 (2.8 MiB)

 

[root@DB-Server ~]# more /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

10.20.34.76        DB-Server.localdomain DB-Server

127.0.0.1               localhost.localdomain localhost

::1             localhost6.localdomain6 localhost6

[root@DB-Server ~]# 

果然发现/etc/hosts下配置为10.20.34.76, 具体原因是因为IT部门调换办公室,从三楼撤到二楼,将这台PC搬下来后,服务器IP地址变化了,修改/etc/hosts,然后重启监听服务,问题解决。

ORA-12514, TNS:listener does not currently know of service requested in connect descriptor案例2的更多相关文章

  1. oracle ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

    ORA-12514: TNS:listener does not currently know of service requested in connect descriptor 1.看看是不是监听 ...

  2. oracle centos 重启后报错ORA-12514, TNS:listener does not currently know of service requested in connect descriptor

    oracle centos 重启后报错ORA-12514, TNS:listener does not currently know of service requested in connect d ...

  3. ORA_12514:TNS:listener does not currently know of service requested in connect descriptor

    问题描述 ORA_12514:TNS:listener does not currently know of service requested in connect descriptor 解决方式 ...

  4. TNS:listener does not currently know of service requested in connect descriptor错误改正

    (SID_LIST = (SID_DESC =  (SID_NAME = PLSExtProc)  (ORACLE_HOME = E:\oracle\product\10.2.0\db_1)  (PR ...

  5. dataguard ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

    错误的意思是listener 不知道连接解析器中的请求服务,这里要说静态监听和动态监听了动态注册是在instance启动的时候PMON进程根据init.ora中的instance_name,servi ...

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

    this issue and the fix was to make sure in tnsnames.ora the SERVICE_NAME is a valid service name in ...

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

    https://blog.csdn.net/mchdba/article/details/50166153

  8. ORA-12514:TNS:lisntener does not currently know of service requested in connect descriptor

    在使用工具连接oracle库的时候出现了异常 根据理解初步估计是服务或者监听器没有启动 于是链接到数据库服务器进行查看  服务都已经开启,重启后链接依旧出现上述问题 使用lsnrctl status  ...

  9. Oracle - ORA-12505, TNS:listener does not currently know of SID given in connect descriptor 解决

    java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:list ...

随机推荐

  1. Apache XBean相关说明,待补充

    前言 最近在看ActiveMQ5.15.0源码,发现ActiveMQ实际上是基于spring实现的,其配置文件activemq.xml中有个broker元素节点,使用的就是Apache XBean的配 ...

  2. 【干货】利用MVC5+EF6搭建博客系统(二)测试添加数据、集成Autofac依赖注入

    PS:如果图片模糊,鼠标右击复制图片网址,然后在浏览器中打开即可. 一.测试仓储层.业务层是否能实现对数据库表的操作 1.在52MVCBlog.IRepository程序集下创建IsysUserInf ...

  3. SpringBoot2.0源码分析(三):整合RabbitMQ分析

    SpringBoot具体整合rabbitMQ可参考:SpringBoot2.0应用(三):SpringBoot2.0整合RabbitMQ RabbitMQ自动注入 当项目中存在org.springfr ...

  4. 在Mac下连接阿里云服务器

    1.登录 ssh root@IP地址 eg:00.00.00.00 2.新建用户 useradd -d /home/用户名 -m 根目录名 (这条命令,就是创建一个新用户,并给该用户在home目录下创 ...

  5. Mysql加锁过程详解(6)-数据库隔离级别(1)

    Mysql加锁过程详解(1)-基本知识 Mysql加锁过程详解(2)-关于mysql 幻读理解 Mysql加锁过程详解(3)-关于mysql 幻读理解 Mysql加锁过程详解(4)-select fo ...

  6. 为什么使用SLF4J比使用log4j或者java.util.logging更好

    1.SLF4j是什么? SLF4J 并没有真正地实现日志记录,它只是一个允许你使用任何java日志记录库的抽象适配层. 如果你正在编写内部或者外部使用的API或者应用库的话,如果使用了slf4j,那么 ...

  7. gops —— Go 程序诊断分析工具

    GitHub: https://github.com/google/gops 一个用于列出和诊断分析系统中正在运行的 Go 程序的命令行工具 安装 go get -u github.com/googl ...

  8. 最近公共祖先(least common ancestors,LCA)

    摘要: 本文主要介绍了解决LCA(最近公共祖先问题)的两种算法,分别是离线Tarjan算法和在线算法,着重展示了在具体题目中的应用细节. 最近公共祖先是指对于一棵有根树T的两个结点u和v,它们的LCA ...

  9. Go Web:数据存储(2)——CSV文件

    存储到CSV文件中 1.内存存储 2.CSV文件存储 3.gob序列化存储 本文接上一篇:内存存储. 关于CSV文件的说明,见csv文件格式 当数据存储到了内存中,可以在需要的时候持久化保存到磁盘文件 ...

  10. 在C#中使用ZBar识别条形码

    目录: 一.识别库 二.从一张图片中提取多个条形码 三.注意事项 从博客园学了很多,本着分享的目的,希望后来者遇到类似问题时,不必重复造轮子,早点下班回家^-^. 一.识别库 目前主流的识别库主要有Z ...