Sunday, October 25, 2009

Find IP Address and Host Name of Oracle Server from Client Environment

Invoke the following section to get the Oracle Database Server IP Address from Client Environment.

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;
/


Get the IP Address of the client

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