Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
';ORA-21561:远程Oracle 12c XE实例的OID生成失败-Mac上Windows 10客户端上的Oracle(cx_Oracle使用python)_Python_Oracle - Fatal编程技术网

';ORA-21561:远程Oracle 12c XE实例的OID生成失败-Mac上Windows 10客户端上的Oracle(cx_Oracle使用python)

';ORA-21561:远程Oracle 12c XE实例的OID生成失败-Mac上Windows 10客户端上的Oracle(cx_Oracle使用python),python,oracle,Python,Oracle,我正在尝试使用mac计算机上的cx_Oracle包,通过python连接到Windows 10上运行的Oracle实例。 现在,当连接它时,抛出下面的错误。 “ORA-21561:OID生成失败\n” 我的示例代码: import cx_Oracle DSN = cx_Oracle.makedsn(host=server, port=port, service_name=database) # Below is the DNS # (DESCRIPTION=(ADDRESS=(PROTOCOL

我正在尝试使用mac计算机上的cx_Oracle包,通过python连接到Windows 10上运行的Oracle实例。 现在,当连接它时,抛出下面的错误。 “ORA-21561:OID生成失败\n”

我的示例代码:

import cx_Oracle

DSN = cx_Oracle.makedsn(host=server, port=port, service_name=database)
# Below is the DNS
# (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.9)(PORT=50244))(CONNECT_DATA=(SERVICE_NAME=devXDB)))
con = cx_Oracle.Connection(user, password, DSN)
不过,我可以使用SQL developer和PyCharm的数据库浏览器从同一台机器(mac)进行连接。我到处搜索,没有找到任何与远程实例相关的解决方案。建议的解决方案似乎只适用于必须在windows 10上编辑/更新etc/hosts或相关文件的本地实例


提前感谢。

这确实是/etc/hosts文件问题。 这里需要注意的一点是,即使oracle实例在远程计算机上运行,您的客户机(从那里连接到oracle实例)/etc/hosts文件也应该有这样的条目

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost localhost.localdomain Amits-iMac.local

将“Amits iMac.local”替换为客户端的主机名。

这确实是/etc/hosts文件问题的症结所在。 这里需要注意的一点是,即使oracle实例在远程计算机上运行,您的客户机(从那里连接到oracle实例)/etc/hosts文件也应该有这样的条目

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost localhost.localdomain Amits-iMac.local
将“Amits iMac.local”替换为客户端的主机名