关闭

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

1219人阅读 评论(0) 收藏 举报
分类:

实验介绍:

192.168.5.231远程连接192.168.6.51的orcl实例。


在192.168.6.51上查看:

SQL> show parameter name;


NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
cell_offloadgroup_name     string
db_file_name_convert     string
db_name     string ORCL
db_unique_name     string ORCL
global_names     boolean FALSE
instance_name     string orcl
lock_name_space     string
log_file_name_convert     string
pdb_file_name_convert     string
processor_group_name     string
service_names     string ORCL.orcl


网上说,tnsnames.ora文件中的SERVICE_NAME填写SID,于是这样配置:

在192.168.5.231的tnsnames.ora配置文件内容如下:

orcl =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.6.51)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )


远程连接:

sqlplus dandan/dandan@orcl

报错:

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


我将tnsnames.ora文件中的SERVICE_NAME = orcl改为SERVICE_NAME =ORCL.orcl后就可以正确访问了。


用lsnrctl status也可以看到service name:

[oracle@ser6-51 admin]$ lsnrctl status


LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 07-JUL-2015 14:45:41


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


Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ser6-51)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                07-JUL-2015 11:47:05
Uptime                    0 days 2 hr. 58 min. 35 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12c/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/ser6-51/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ser6-51)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "ORCL.orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "ORCLXDB.orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully


#总结:tnsnames.ora文件中的SERVICE_NAME可以这样查看:

①:

SQL> show parameter service_name;


NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names     string ORCL.orcl

②:lsnrctl status


0
0

猜你在找
【套餐】Hadoop生态系统零基础入门
【套餐】嵌入式Linux C编程基础
【套餐】2017软考系统集成项目——任铄
【套餐】Android 5.x顶级视频课程——李宁
【套餐】深度学习入门视频课程——唐宇迪
【直播】广义线性模型及其应用——李科
【直播】从0到1 区块链的概念到实践
【直播】计算机视觉原理及实战——屈教授
【直播】机器学习之凸优化——马博士
【直播】机器学习&数据挖掘7周实训--韦玮
查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1026328次
    • 积分:14162
    • 等级:
    • 排名:第860名
    • 原创:317篇
    • 转载:626篇
    • 译文:3篇
    • 评论:92条