Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

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
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 4 2012
Added on Jan 6 2012
2 comments
952 views