SQL ORA-29273: HTTP 请求失败使用 utl_http 包的间歇性错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20271592/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 23:18:02  来源:igfitidea点击:

ORA-29273: HTTP request failed intermittent error using the utl_http package

sqloracleplsqloracle11goracle-apex

提问by RandomCoder

I'm using the utl_httppackage to make HTTP GET requests to an IIS site on the same server (local) as Oracle. Sometimes it works and I get the response, but more often than not it hangs for about 15 seconds and then I get this error:

我正在使用该utl_http包向与 Oracle 相同的服务器(本地)上的 IIS 站点发出 HTTP GET 请求。有时它可以工作并且我得到响应,但通常它会挂起大约 15 秒,然后我收到此错误:

ORA-29273: HTTP request failed ORA-06512: at "SYS.UTL_HTTP", line 1722 ORA-29263: HTTP protocol error

ORA-29273:HTTP 请求失败 ORA-06512:在“SYS.UTL_HTTP”,第 1722 行 ORA-29263:HTTP 协议错误

As a test, I've got a small static text file in the IIS site, so this is how I'm testing it:

作为测试,我在 IIS 站点中有一个小的静态文本文件,所以这是我测试它的方式:

select utl_http.request('http://domain.com/test.txt') from dual

I get the same problem if I run it in Oracle Apex instead of direct on the db.

如果我在 Oracle Apex 中运行它而不是直接在数据库上运行它,我会遇到同样的问题。

The other thing I've tried is to create a package of my own that does the HTTP request using the long utl_htp.begin_request()method, instead of the utl_http.request()shortcut. This gives the exact same problem (works sometimes but errors mostly - same error).

我尝试过的另一件事是创建一个我自己的包,它使用 longutl_htp.begin_request()方法而不是utl_http.request()快捷方式执行 HTTP 请求。这给出了完全相同的问题(有时有效,但主要是错误 - 相同的错误)。

The pattern I'm seeing is if I wait a while and then try, it works for the first 2-10 times, and then begins erroring. When it does work, I get the response instantly and when it errors, there is always the delay before the error.

我看到的模式是,如果我等待一段时间然后尝试,它会在前 2-10 次工作,然后开始出错。当它起作用时,我立即得到响应,当它出错时,在出错之前总是有延迟。

If I request the text file URL (or any other resource in the site) using a remote web browser then I get the correct response every time.

如果我使用远程 Web 浏览器请求文本文件 URL(或站点中的任何其他资源),那么我每次都会得到正确的响应。

I have tried setting a timeout like below but it doesn't have any effect. For example instead of timing out after 3 seconds it continues for 10 or 15 seconds before the error is shown.

我曾尝试设置如下超时,但没有任何效果。例如,它不会在 3 秒后超时,而是在显示错误之前持续 10 或 15 秒。

UTL_HTTP.set_transfer_timeout(3);

I think I can rule out ACL because it works sometimes.

我想我可以排除 ACL,因为它有时会起作用。

Does anyone know what might cause this behaviour?

有谁知道什么可能导致这种行为?

回答by Calipso

Possible reasons

可能的原因

-> You may have a problem with your TNS-Listener.

-> 您的 TNS-Listener 可能有问题。

From the command prompt window, try to run TNSPING service_name.. try to run it quickly several times and check if it fails in some of them.

在命令提示符窗口中,尝试运行TNSPING service_name.. 尝试快速运行几次并检查它是否在其中一些失败。

I had once a similar problem. Try to re-configure your TNS-Listener.

我曾经遇到过类似的问题。尝试重新配置您的 TNS-Listener。

There must be also an option in which you can give an IP number in the TNS-listener definition. This also solves sometimes these kind of problems.

还必须有一个选项,您可以在其中提供 TNS 侦听器定义中的 IP 编号。这有时也解决了这类问题。

-> IIS problem.

-> IIS 问题。

回答by user3932600

Read about SET_PERSISTENT_CONN_SUPPORT Procedure: https://docs.oracle.com/cd/B28359_01/appdev.111/b28419/u_http.htm#i1027673

阅读 SET_PERSISTENT_CONN_SUPPORT 程序:https://docs.oracle.com/cd/B28359_01/appdev.111/b28419/u_http.htm#i1027673

Using: utl_http.set_persistent_conn_support(true, 30);

使用:utl_http.set_persistent_conn_support(true, 30);

回答by fhossfel

Could you be exceeding the limit of of concurrent HTTP connections? I vaguely remembering that I run into a similar problem when I forgot to close the HTTP connection.

您是否会超出并发 HTTP 连接的限制?我依稀记得我在忘记关闭 HTTP 连接时遇到了类似的问题。