Oracle PL/SQL 获取服务器的 IP v4?

2021-12-24 00:00:00 oracle11g oracle plsql plsqldeveloper

如何使用 PL/SQL 获取服务器的 IP v4?UTL_INADDR.GET_HOST_ADDRESS 给了我 IPv6,而我需要 IPv4

How can I get the IP v4 Of the server by using PL/SQL ? UTL_INADDR.GET_HOST_ADDRESS gives me IPv6, while I need IPv4

我做了什么我在服务器上禁用了 IPv6,它仍然给我带来了隧道适配器 Teredo 隧道伪接口"的 IPv6 !!

what I did I disabled the IPv6 on the sever, still it's bringing me the the IPv6 of the "Tunnel adapter Teredo Tunneling Pseudo-Interface" !!

我在 Windows 2008 R2 服务器上使用 Oracle 11g 数据库

I'm using Oracle 11g database on Windows 2008 R2 Server

推荐答案

UTL_INADDR.GET_HOST_ADDRESS 只返回一个 ip,这是无意义的,因为服务器可能有几十个.可能你最好的选择是创建一个 Java 方法的 pl/sql 包装器,它使用 NetworkInterface.getNetworkInterfaces();

UTL_INADDR.GET_HOST_ADDRESS returns just an ip which is nonsense since a server may have dozens of them. Probably your best bet it's to create a pl/sql wrapper of a Java method which returns every possible ip address using NetworkInterface.getNetworkInterfaces();

相关文章