暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Oracle 如果未与utl_http.begin_request建立连接,作业将结束

ASKTOM 2019-10-10
1073

问题描述

我正在通过web服务通过pl/sql跟踪17000订单到目标服务器。我正在批量运行多个作业 (每个作业500个订单) 以调用webservice以获取订单状态。因此,大约有34个作业同时运行 (17000/500),以获取每个500订单的状态。现在,我的工作很少能正常完成,但很少能长期运行,并且没有完成并卡住 (甚至没有给出任何错误或异常),因为未通过utl_http.begin_request与目标服务器建立连接。
我已经添加了UTL_HTTP.set_transfer_timeout,但是我相信这可以获取响应,但是这里的连接本身没有建立。
请给我一个解决方案,以便在这种情况下,如果我无法建立连接,那么作业应该结束给出一些错误。

专家解答

MOS note 760664.1涵盖此问题。

简短的答案是超时doesn't适用于making初始连接。只有建立连接后才能拨打电话。

幸运的是有一个解决方法:

In Oracle there is a workaround to this limitation, you can configure the TCP connection timeout by setting any of the below SQL*Net parameter:

* SQLNET.OUTBOUND_CONNECT_TIMEOUT
* TCP.CONNECT_TIMEOUT

The outbound connect timeout is a super set of the TCP connect timeout which specifies a limit on the time taken to establish a TCP connection. For more information about these parameters, you can refer to chapter "Parameters for the sqlnet.ora File" in "Oracle Database Net Services Reference" guide.

Example:
Inside the SQLNET.ORA file on the database server, add any of the following parameters which will time out all the TCP connection attempts that take longer than the specified number of seconds to connect.
TCP.CONNECT_TIMEOUT = 30
or
SQLNET.OUTBOUND_CONNECT_TIMEOUT = 30

Limitation:

Setting these parameters will not only impose a 30 second timeout for UTL_HTTP package, but it will affect all outbound TCP connections from the database. So, only consider using this workaround if you would like to limit the connection timeout for ALL TCP connections from your database.

文章转载自ASKTOM,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论