Skip to Main Content

sys_context('USERENV', 'IP_ADDRESS') and sys_context('USERENV', 'OS_USER')

Jason VogelJan 6 2012 — edited Jan 7 2012
We have installed a Database Login trigger to "audit" who is logging in, how, and from where. It makes a simple call to sys_context and inserts the results into a table.

However, we are running into an interesting issue where sys_context('USERENV', 'IP_ADDRESS') and sys_context('USERENV', 'OS_USER') will sometime return Null.

I've replaced the actual IPs with xxx.xxx.xxx.

Query:

select
a.authenticated_identity,
NVL(a.ip_address,'< Null? >') IP,
NVL(a.os_user,'< Null? >') OSUser
from
TBL_LOGIN_TRIGGER_AUDIT a

Results:

AUTHENTICATED_IDENTITY IP_ADDRESS OS_USER
--------------
ORACLE < Null? > ORACLE
SYNCH_FIN < Null? > SCHEDMIN
PROD < Null? > DAEMON
SYSTEM < Null? > ORACLE
OPS < Null? > SCHEDMIN
PROD < Null? > ORACLE
OPS xxx.xxx.xxx.xxx AHSREPORTS
EFS xxx.xxx.xxx.xxx EFS
JAVA_BUSINESS_TIER xxx.xxx.xxx.xxx < Null? >
JAVA_BUSINESS_TIER xxx.xxx.xxx.xxx WEBLOGIC
PROD xxx.xxx.xxx.xxx SCHEDMIN
JAVA_BUSINESS_TIER xxx.xxx.xxx.xxx < Null? >
JAVA_BUSINESS_TIER xxx.xxx.xxx.xxx < Null? >
SYSTEM xxx.xxx.xxx.xxx ORACLE

*How could the IPAddress and OSuser sometimes be Null?*

Thanks,
Jason
Comments
Post Details
Added on Jan 6 2012
2 comments
352 views