ORA-12545: 连接失败,因为目标主机或对象不存在

发布于 2024-10-13 22:19:42 字数 330 浏览 1 评论 0原文

以前有人遇到过这个错误吗?我尝试参考此链接: http://www. ardentperf.com/2007/04/02/local_listener-and-ora-12545/

但这并不能真正解决我们的问题。我们的场景是我们能够连接到数据库,但是当我们尝试从视图中选择数据时,我们会遇到此错误。

我已启用客户端 sqlnet 跟踪,但我无法解释问题的确切原因。

有人有什么想法吗?

谢谢

Have anyone encounter this error before? I tried to refer to this link: http://www.ardentperf.com/2007/04/02/local_listener-and-ora-12545/

But it doesn't really resolve our issue. Our scenario is that we are able to connect to the database however we will encounter this error when we try to select data from a view.

I have enabled Client-side sqlnet trace but i am unable to interpret what is the exact cause of the issue.

Any ideas anyone?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

述情 2024-10-20 22:19:42

对我来说,问题是未通过 TNSNAMES.ora 中的名称检测到主机,而是使用 IP 地址解决了该问题(我认为这是由于域控制器问题):

XYZD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 123.45.67.89)(PORT = 1521))
    (CONNECT_DATA = (SERVICE_NAME = XYZD))
  )

执行命令:“ping HOST”来查找服务器IP 地址。

  • PING HOST
  • TELNET HOST PORT
  • TNSPING TNS_ALIAS

编辑:

刚刚再次遇到这个问题,这次是防火墙通过端口阻止了 TCP。

For me the problem was the HOST was not being detected by name in the TNSNAMES.ora, using the IP address instead resolved it (I think its due to a domain controller issue):

XYZD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 123.45.67.89)(PORT = 1521))
    (CONNECT_DATA = (SERVICE_NAME = XYZD))
  )

Do a command: “ping HOST” to find the servers IP address.

  • PING HOST
  • TELNET HOST PORT
  • TNSPING TNS_ALIAS

Edit:

Just ran into this again, this time it was a Firewall blocking TCP via the port.

意犹 2024-10-20 22:19:42

这个问题可能有多种原因:

1.您的 TNSNAMES.ora 不是最新的

修复:找到您的 Oracle 主目录
查找目录:/network/ADMIN/

如果您在本地计算机上遇到此问题,

TNSNAMES.ora 应该位于其中2。创建 TNS_ADMIN 环境变量

在我的例子中:

变量名称:TNS_ADMIN

值:C:\Programs\Ora10g\network\ADMIN

出于测试目的,请尝试使用 sqlplus 连接到 Oracle DB(您可能已经在尝试此操作)。

This issue can be multiple things:

1. Your TNSNAMES.ora isn't up to date

Fix: Find your Oracle Home
Find Directory: /network/ADMIN/

TNSNAMES.ora should be in there if you're experiencing this issue on a local machine

2. Create TNS_ADMIN Environmental Variable

In my case:

Variable Name: TNS_ADMIN

Value: C:\Programs\Ora10g\network\ADMIN

For testing purposes, try connecting to the Oracle DB using sqlplus (you may already be trying this).

卸妝后依然美 2024-10-20 22:19:42

我也遇到了这个问题,由于我没有使用 tnsnames.ora 文件,当我踩到这个 链接
所以,现在我的代码如下所示:

import cx_Oracle 
connection_string = '''username/password@(DESCRIPTION=
                                            (ADDRESS_LIST=
                                                (ADDRESS=
                                                    (PROTOCOL=TCP)
                                                    (HOST=<host_name>)
                                                    (PORT=<port_numer>)
                                                )
                                            )
                                            (CONNECT_DATA=
                                                (SID=<your_SID>)
                                            )
                                        )'''
db = cx_Oracle.connect(connection_String)

现在您可以创建游标并编写查询。
注意:这不是推荐的做法,但我只是将其用于测试。

I also had this issue, and since I was not using a tnsnames.ora file, I almost gave up hope, when I stepped on this link.
So, now my code looks like this:

import cx_Oracle 
connection_string = '''username/password@(DESCRIPTION=
                                            (ADDRESS_LIST=
                                                (ADDRESS=
                                                    (PROTOCOL=TCP)
                                                    (HOST=<host_name>)
                                                    (PORT=<port_numer>)
                                                )
                                            )
                                            (CONNECT_DATA=
                                                (SID=<your_SID>)
                                            )
                                        )'''
db = cx_Oracle.connect(connection_String)

Now you can create a cursor and write your query.
Note: This is not a recommended practice, but I used it just for testing.

素年丶 2024-10-20 22:19:42

我收到此错误,原因是我试图连接错误的端口。

i've got this error and the reason for me was that I was trying to connect on the wrong PORT.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文