Logon Trigger’ının yazılması


Aşağıdaki Condition’daki her bir user’ için aşağıdaki logon trigger yaratılır.

if v_USERNAME in (  'CHEQUE',
                    'CHEQUEAPP',
                    'ETCUSER',
                    'ETCUSEREXT',
                    'MASTER',
                    'MONLEON'
                 )

CREATE OR REPLACE TRIGGER SYS.LOGON_TRIGGER_MASTER
AFTER LOGON
ON SYS.SCHEMA
DECLARE
   v_sid       number;
   v_program   VARCHAR2 (128);
   v_module    VARCHAR2 (128);
   v_username  VARCHAR2 (128);
   v_machine   VARCHAR2 (128);
   v_osuser    VARCHAR2 (128);
BEGIN
   SELECT machine,
          osuser,
          module,
          program,
          username,
          sid
     INTO v_machine,
          v_osuser,
          v_module,
          v_program,
          v_username,
          v_sid
     FROM v$session
    WHERE sid= ( SELECT sid
                    FROM v$mystat
                    WHERE ROWNUM = 1 );
if LOGON_TRIG(v_sid,v_program,v_module,v_username ,v_machine,v_osuser ) = 1
Then
     goto atla ;
else
     insert into logon_logs values ( sysdate,v_program,v_module,v_username,v_machine,v_osuser);
     COMMIT;
     raise_application_error(-20001,'LOGON NOT ALLOWED');
end if;
<< atla >>
null;
END;
/

 


		

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: