Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Oracle Failed Login Trigger - Capture Oracle User

Posted on 2012-03-27
3
1,423 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
ID: 37771625
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
ID: 37771689
That appears to have worked.  Thank you.
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 37771818
No problem.  Glad to help.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
join 2 views with 5 conditions 3 61
Oracle SQL Select unique values from two columns 4 66
Help on model clause 5 37
oracle date format checking 7 26
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

856 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