Find IP address [message #118152] |
Tue, 03 May 2005 06:04 |
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 #118195 is a reply to message #118183] |
Tue, 03 May 2005 10:11 |
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
|
|
|