Solved

Oracle Failed Login Trigger - Capture Oracle User

Posted on 2012-03-27
3
1,396 Views
Last Modified: 2012-03-27
How can the Oracle username be captured using a trigger and table for a failed log on attempt.  I'm aware Oracle auditing captures this information. See example below:

create table stats$user_log
(
   terminal            varchar2(255),
   os_username         varchar2(255),
   username            varchar2(30),
   extended_timestamp  date)
tablespace users
;

CREATE OR REPLACE TRIGGER failed_logon_trg
  AFTER SERVERERROR ON DATABASE
  when (ora_server_error(1)=1017)
BEGIN
   insert into stats$user_log
      (terminal, os_username, username, extended_timestamp)
   values
      (SYS_CONTEXT('USERENV','TERMINAL'),
      SYS_CONTEXT('USERENV','OS_USER'),
      USER,
      sysdate);
      COMMIT;
END failed_logon_trg;
/

I've tried both 1) USER result NULL and 2) SYS_CONTEXT('USERENV','CURRENT_USER') result SYS
0
Comment
Question by:ciphersol
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
Comment Utility
Are you wanting to capture the attempted username that failed?

Not sure if this will work for you but try: AUTHENTICATED_IDENTITY for SYS_CONTEXT.

http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions165.htm
0
 

Author Comment

by:ciphersol
Comment Utility
That appears to have worked.  Thank you.
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
No problem.  Glad to help.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now