You Asked

Hi Tom



I would like to know how to get a remote client IP adress and local client IP adress.

Is it right to say that the local client IP adress equal to IP adress of a Server ( client and server on the same machine)?

I suppose we use sys_contex to get it

and could I kill a session of SYS user?

Have a good day and best regards







and we said...

ops$tkyte@ORA920> select utl_inaddr.get_host_address(host_name), host_name from v$instance;



UTL_INADDR.GET_HOST_ADDRESS(HOST_NAME)

-----------------------------------------------------------------------------------------------------------------------------------

HOST_NAME

----------------------------------------------------------------

192.168.0.3

tkyte-pc-isdn.us.oracle.com





gets you the server ip address. sys_context( 'userenv', 'ip_address' ) gets you the client address - returns NULL if the user is not using TCP/IP.



However, a login trigger is NOT going to disallow SYS from logging in. (login triggers cannot "fail" a DBA login). You could send yourself an EMAIL, you could schedule a DBMS_JOB to kill the session shortly (but hey, sys could quickly set job_queue_processes=0 to subvert you)



Best bet -- never but never use SYS -- never. By default people cannot log in as SYS.



Let your best and brightest DBA's have SYSDBA or SYSOPER and don't allow for remote sysdba/sysoper login and you'll never have a remote SYS login.









and you rated our response

(9 ratings)

Is this answer out of date? If it is, please let us know via a Review