重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 6283|回复: 1
打印 上一主题 下一主题

[Oracle] ORA-12514,TNS:listener does not currently know of service requested in conne...

[复制链接]
跳转到指定楼层
楼主
发表于 2017-12-14 18:14:32 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
[root@strong ~]# su - oracle
[oracle@strong ~]$ sqlplusscott/tiger@YADATA
SQL*Plus: Release 11.2.0.4.0 Production onThu Dec 14 01:33:39 2017
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currentlyknow of service requested in connect
descriptor

Enter user-name:

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

[root@strong admin]# su - oracle
[oracle@strong ~]$ cd $ORACLE_HOME
[oracle@strong db_1]$ cd network
[oracle@strong network]$ ll
总用量 36
drwxr-xr-x. 3 oracle dba 4096 12月 14 02:04 admin
drwxr-xr-x. 2 oracle dba 4096 6月  28 13:55 doc
drwxr-xr-x. 4 oracle dba 4096 6月  28 13:54 install
drwxr-xr-x. 2 oracle dba 4096 6月  28 13:56 jlib
drwxr-xr-x. 2 oracle dba 4096 6月  28 13:57 lib
drwxrwx---. 2 oracle dba 4096 6月  29 12:21 log
drwxr-xr-x. 2 oracle dba 4096 6月  28 13:56 mesg
drwxr-xr-x. 4 oracle dba 4096 6月  28 13:56 tools
drwxrwx---. 2 oracle dba 4096 6月  28 13:58 trace
[oracle@strong network]$ cd admin
[oracle@strong admin]$ ll
总用量 20
-rw-r--r--. 1 oracle dba  367 6月  29 11:10 listener17062911上午1043.bak
-rw-r--r--. 1 oracle dba  367 12月 14 02:03 listener.ora
drwxr-xr-x. 2 oracle dba 4096 6月  28 13:53 samples
-rw-r--r--. 1 oracle dba  381 12月 17 2012 shrept.lst
-rw-r-----. 1 oracle dba  325 12月 14 02:04 tnsnames.ora
[oracle@strong admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

YADATA =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = strong)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = YADATA)
    )
  )

2检查确认数据库实例启动情况,实例名。
SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
YADATA

SQL> select status from v$instance;

STATUS
------------

OPEN

查看监听状态
[oracle@strong admin]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 14-DEC-2017 02:12:22

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=strong)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                28-JUN-2017 14:09:58
Uptime                    168 days 12 hr. 2 min. 25 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/strong/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=strong)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "YADATA" has 1 instance(s).
  Instance "YADATA", status READY, has 1 handler(s) for this service...
Service "YADATAXDB" has 1 instance(s).
  Instance "YADATA", status READY, has 1 handler(s) for this service...
The command completed successfully
监听服务也正常,没有问题

检查  /u01/app/oracle/diag/tnslsnr/strong/listener/alert/log.xml下的日志,发现host_addr为192.168.133.131,实际IP地址不是这个。因为监听文件里面我使用的HOST=strong,所以赶紧检查/etc/hosts的配置


检查/etc/hosts的配置
[root@strong admin]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.133.131   strong  

本机ip为192.168.133.144
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

沙发
发表于 2017-12-16 12:38:17 | 只看该作者
确实,这个错误平时很常见.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-5-7 01:46 , Processed in 0.136095 second(s), 22 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表