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

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

一台测试服务器上的数据库无法访问,远程能访问服务器1521端口,但是通过pl/sql连不上。
    登录数据库服务器,执行:
     $ lsnrctl status
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.155.100)(PORT=1525)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
居然没有service注册上。检查数据库service配置:
sql> show parameter service_names
service_names                        string      dg1.oracle.com,hr,oa 
sql>show parameter instance_name
instance_name                        string      dg
sql> show parameter domian_name
db_domain                            string      oracle.com
 
检查listener.ora
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
      (PROGRAM = extproc)
    )
  )
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.155.100)(PORT = 1521))
    )
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )
配置无问题
 
检查tnsnames.ora
OA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.155.100)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = oa.oracle.com)
    )
  )
HR =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.155.100)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = hr.oracle.com)
    )
  )
DG =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.155.100)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = dg1.oracle.com)
    )
  )
也没发现有问题,但是通过tns登录:sqlplus 报错:
TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
手工注册service:
sql> alter system register
服务仍然不能注册到listener。
这时突然想到了local_listner参数,
sql> show parameter local_listener
(address=(protocol=tcp)(host=192.168.129.201)(port=1521))
而listener实际用的ip是192.168.155.100。
发现这台机器有两张网卡,ip分别为:192.168.155.100和192.168.129.201,之前有维护人员大概想将listener绑定到192.168.129.201这个ip上,但采用的方法不对。
修改local_listener参数,sql> alter system set local_listener='';
再重新注册服务,sql> alter system register;
查看注册情况,$ lsnrctl status
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "dg1.oracle.com" has 1 instance(s).
  Instance "dg", status READY, has 4 handler(s) for this service...
Service "dg1_XPT.oracle.com" has 1 instance(s).
  Instance "dg", status READY, has 4 handler(s) for this service...
Service "hr.oracle.com" has 1 instance(s).
  Instance "dg", status READY, has 4 handler(s) for this service...
Service "oa.oracle.com" has 1 instance(s).
  Instance "dg", status READY, has 4 handler(s) for this service...
service_names中定义的服务都成功动态注册到listener。
远程pl/sql连接数据库成功。
 
--本篇文章转自:

转载于:https://www.cnblogs.com/yabingshi/p/3929879.html

你可能感兴趣的文章
optimizer_dynamic_sampling
查看>>
HTML(WEB)开发day05
查看>>
5月16日(优化链串BF算法、
查看>>
php学习
查看>>
第四节 选择结构和循环结构
查看>>
新的Android应用 记账理财助手 登陆国内各大市场啦。
查看>>
【转】c++中placement new操作符
查看>>
收缩日志
查看>>
tmux
查看>>
Android实现自动登录
查看>>
【转】LeakCanary
查看>>
导入Excel 时间格式验证
查看>>
序列合并求前K小项 POJ2442
查看>>
unity点选构建Mesh并保存OBJ
查看>>
python kmeans实战 - 单机一层聚类(小玩具哦),下次再弄个分布式多次聚类
查看>>
Java主要有那几种文件类型?各自的作用是什么?
查看>>
我的第一个python web开发框架(29)——定制ORM(五)
查看>>
2017.11.18 手把手教你学51单片机-点亮LED
查看>>
xml的创建与解析
查看>>
grep不区分大小写查找字符串方法
查看>>