cx_Oracle.DatabaseError:ORA-12514:TNS:侦听器当前不知道连接描述符中请求的服务 [英] cx_Oracle.DatabaseError: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

查看:1341
本文介绍了cx_Oracle.DatabaseError:ORA-12514:TNS:侦听器当前不知道连接描述符中请求的服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过Python程序对新安装的Oracle client 12.2 in RHEL 7 linux进行完整性测试,但由于上述错误而失败,不确定我在那儿缺少什么.请为这种情况提供帮助:

I am trying to do a sanity testing of newly installed Oracle client 12.2 in RHEL 7 linux from a Python program, but it fails with the above error, not sure what I am missing on there. Please help with this case :

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

我的tnsnames.ora文件在/home目录下

my tnsnames.ora file under /home directory

  FRDLD2D1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(Host = frdld2d1.de.db.com)(Port = 1825))
    )
    (CONNECT_DATA =
      (SID = FRDLD2D1)
      )
   )

和我的python程序在下面

#!/usr/bin/python
import cx_Oracle
#connection = cx_Oracle.connect('PNTH_LOGGINGB_OWNER/password')
connection = cx_Oracle.connect('PNTH_LOGGINGB_OWNER/password@10.245.63.34:1825/orcl')
cursor = connection.cursor()
querystring = "select * from BDR_JOB_MASTER_LOG where ROWNUM <= 1;"
cursor.execute(querystring)

frdld2d1.de.db.com -IP地址: 10.245.63.34

了解是否有毛刺出现在这里.

Appreciate if any points the glitch on here.

tnsping实用程序不是测试版,因为它是instaclient版本

tnsping utility is not there to test since it is an instaclient version

oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm.

但是使用SQLPlus,我可以毫无问题地连接数据库.

But with SQLPlus, I am able to connect the database without any issues.

推荐答案

请使用此作为您的连接字符串:

Please use this as your connection string :

connection = cx_Oracle.connect('PNTH_LOGGINGB_OWNER', 'hdgf_76trf', 
                                cx_Oracle.makedsn('10.245.63.34',1825,'FRDLD2D1') );

TNSNAMES.ORA文件中将SERVICE_NAME = FRDLD2D1更改为SID = FRDLD2D1可能是替代方法.

Changing SERVICE_NAME = FRDLD2D1 to SID = FRDLD2D1 in your TNSNAMES.ORA file may be an alternative.

这篇关于cx_Oracle.DatabaseError:ORA-12514:TNS:侦听器当前不知道连接描述符中请求的服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆