Tuesday, 20 March 2012

Oracle - Get IP address & host with

The utl_inaddr procedure:

SET serveroutput on
BEGIN
  DBMS_OUTPUT.PUT_LINE(UTL_INADDR.GET_HOST_NAME);  -- get local host name
  DBMS_OUTPUT.PUT_LINE(UTL_INADDR.GET_HOST_ADDRESS);  -- get local IP addr
END;
/

The sys_context procedure

select SYS_CONTEXT('USERENV', 'IP_ADDRESS', 15) ipaddr from dual;

1 comment:

  1. Very useful your query to get the ip. of the user for auditing purposes.

    Many thanks.

    ReplyDelete

Number of Visitors