程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> Oracle教程 >> oracle中如何獲取本機ip地址,根據IP地址獲取域名?

oracle中如何獲取本機ip地址,根據IP地址獲取域名?

編輯:Oracle教程

oracle中如何獲取本機ip地址,根據IP地址獲取域名?


-----解析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

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved