2015年Oracle认证考试辅导:UTLINADDR包获取ip地址的内部原理
发布时间:2010/3/13 11:29:08 来源:城市学习网 编辑:MOON
有朋友在MSN上问我如何获得已经连接用户的IP地址。
我们知道,通过SYS_CONTEXT函数可以获得这部分,当前用户的ip等可以通过如下命令轻易获取:SQL> 0select sys_context from dual.
SYS_CONTEXT
WORKGROUP“GQGAI
SQL> 0select sys_context from dual.
SYS_CONTEXT 1982, 2002, Oracle Corporation. All rights reserved.Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - ProductionSQL> !
[oracle@jumper oracle]$ ps -efgrep sql
oracle 14700 14663 1 11:24 pts/0 00:00:00 sqlplus
oracle 14732 14702 0 11:24 pts/0 00:00:00 grep sql
[oracle@jumper oracle]$ ps -efgrep LO
oracle 14701 14700 0 11:24 ? 00:00:00 oracleeygle ))
oracle 14734 14702 0 11:24 pts/0 00:00:00 grep LO
[oracle@jumper oracle]$ exit
exitSQL> SELECT UTL_INADDR.get_host_address from dual.UTL_INADDR.GET_HOST_ADDRESS
-
208.113.151.109