Home » RDBMS Server » Server Administration » Find IP address
Find IP address [message #118152] Tue, 03 May 2005 06:04 Go to next message
vivekmenon_k
Messages: 9
Registered: March 2005
Location: India
Junior Member
How can I find out the IP address of the machine from which SQL statements are being run.

Re: Find IP address [message #118173 is a reply to message #118152] Tue, 03 May 2005 08:17 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Look into v$session, you may get the machine name etc.
I am not very sure about the use of owa_util to get the IP
Re: Find IP address [message #118183 is a reply to message #118152] Tue, 03 May 2005 09:26 Go to previous messageGo to next message
tycoonajayverma
Messages: 17
Registered: May 2005
Location: b'lore
Junior Member

ya u first check out the machine name and use the nslookup command followed by <machine_name> in unix u can us the dig command...
1. nslookup <machine_name>
2. take a help of dig using
man dig

Regards,
Ajay
Re: Find IP address [message #118194 is a reply to message #118152] Tue, 03 May 2005 10:05 Go to previous messageGo to next message
smartin
Messages: 1803
Registered: March 2005
Location: Jacksonville, Florida
Senior Member
I think there is also something in the function:

sys_context('userenv', 'IP_ADDRESS')
Re: Find IP address [message #118195 is a reply to message #118183] Tue, 03 May 2005 10:11 Go to previous message
Frank Naude
Messages: 4587
Registered: April 1998
Senior Member
There are several methods to obtain the IP Address of a connected user. Here are some:

For your own session:

SQL> SELECT SYS_CONTEXT('USERENV', 'IP_ADDRESS') FROM dual;

SYS_CONTEXT('USERENV','IP_ADDRESS')
--------------------------------------------------------------------------------
165.143.144.173


For other user's sessions - using a LOGIN System trigger:

SQL> CONN / AS SYSDBA
Connected.
SQL>
SQL> CREATE OR REPLACE TRIGGER logon_trig
  2  AFTER LOGON ON DATABASE
  3  BEGIN
  4    dbms_application_info.set_client_info('IP '||ora_client_ip_address);
  5  END;
  6  /

Trigger created.


SQL> SELECT client_info FROM v$session
  2   WHERE USERNAME = 'SCOTT'
  3  /

CLIENT_INFO
----------------------------------------------------------------
IP 165.143.144.173


Best regards.

Frank
Previous Topic: Creating database from UNIX files
Next Topic: Session Priority
Goto Forum:
  


Current Time: Fri Jan 10 04:11:58 CST 2025