Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2004
    Posts
    1

    Unanswered: Block session on logon

    Hi!
    I have a problem in Oracle for where I cann't find a solution.
    I have users accessing a database, with an oracle user, but due to some bad coding I cannot change the password. So I want to make some kind of validation when the user tries to logon, and block or not that session!

    For example the user that enters by a unix machine can have acess, but when by a NT machine, certain conditions must be validate. (machine name, application, user login).

    What is the best solution to do it?
    I was thinking in make use of the trigger AFTER LOGON, but can I kill the session? or generate any error that blocks the session?

    Any help or sugestion are welcome...
    :-)

    Rui Marques

  2. #2
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    CREATE OR REPLACE TRIGGER afterlogon
    AFTER LOGON on DATABASE
    BEGIN
    IF sys_context('userenv','Terminal') = 'HALOGENTEACH' THEN
    RAISE_APPLICATION_ERROR (-20001, 'You are not allowed to logon from this
    terminal');
    END IF;
    END;

    Read up on the sys_context function. You will be able to get all the information that you need for your task. Please be aware that afterlogon triggers will NOT lock out anyone with the DBA role. This is to prevent a bad trigger from locking everyone out of the database.
    Last edited by beilstwh; 12-15-04 at 10:34.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •