码迷,mamicode.com
首页 > 数据库 > 详细

oracle 中如何获取本机ip地址,根据IP地址获取域名?

时间:2015-07-29 17:16:24      阅读:375      评论:0      收藏:0      [点我收藏+]

标签:

-----解析ip 地址
SQL> select utl_inaddr.get_host_address(‘google.com‘) from dual;

UTL_INADDR.GET_HOST_ADDRESS(‘GOOGLE.COM‘)
--------------------------------------------------------------------------------
122.229.30.202


-----获取本机IP地址
SQL> select utl_inaddr.get_host_address from dual;
GET_HOST_ADDRESS
--------------------------------------------------------------------------------
10.80.18.241



-----根据IP地址反向解析主机名
SQL> select utl_inaddr.get_host_name(‘10.80.18.241‘) from dual;
UTL_INADDR.GET_HOST_NAME(‘10.80.18.241‘)
--------------------------------------------------------------------------------
lixora




SQL> select utl_inaddr.get_host_name(‘10.80.18.243‘) from dual;


UTL_INADDR.GET_HOST_NAME(‘10.80.18.243‘)
--------------------------------------------------------------------------------
oracle11g-dagi




SQL> select utl_inaddr.get_host_name(‘8.8.8.8‘) from dual;
UTL_INADDR.GET_HOST_NAME(‘8.8.8.8‘)
--------------------------------------------------------------------------------
google-public-dns-a.google.com



SQL> select utl_inaddr.get_host_name(‘10.80.18.210‘) from dual;
select utl_inaddr.get_host_name(‘10.80.18.210‘) from dual
       *
ERROR at line 1:
ORA-29257: host 10.80.18.210 unknown
ORA-06512: at "SYS.UTL_INADDR", line 4
ORA-06512: at "SYS.UTL_INADDR", line 35
ORA-06512: at line 1



SQL> select utl_inaddr.get_host_name(‘10.80.19.210‘) from dual;
select utl_inaddr.get_host_name(‘10.80.19.210‘) from dual
       *
ERROR at line 1:
ORA-29257: host 10.80.19.210 unknown
ORA-06512: at "SYS.UTL_INADDR", line 4
ORA-06512: at "SYS.UTL_INADDR", line 35
ORA-06512: at line 1

版权声明:本文为博主原创文章,未经博主允许不得转载。

oracle 中如何获取本机ip地址,根据IP地址获取域名?

标签:

原文地址:http://blog.csdn.net/lixora/article/details/47129767

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!