26 Dec 2013

Using Wrap Procedure ONLOGN Trigger

1. Make a script file with following code
CREATE OR REPLACE PROCEDURE V_AUTH_PROG
IS
V_PROGR_NAME VARCHAR2(200);
BEGIN
 SELECT UPPER(sys_context('USERENV', 'MODULE')) INTO V_PROGR_NAME
 FROM DUAL;
 IF V_PROGR_NAME <> 'SQLPLUS.EXE' THEN
  RAISE_APPLICATION_ERROR(-20121,'THIRD PARTY TOOL NOT ALLOWED');
 END IF;
END;

2. save the file with v_auth_prog.sql
3. Switch to Command Prompt
4. write the following command on command prompt

D:\WRAP C:\V_AUTH_PROG.SQL TO C:\V_AUTH_PROG_W.SQL

5. Now open the SQLPLUS session and connect with SYS user as Sysdba
6. Run the above scritp
    SQL>@c:\v_auth_prog_w.sql
7.Now create the following code  for onlogon Trigger
   CREATE OR REPLACE TRIGGER DB_LOGON AFTER LOGON ON DATABASE
   CALL V_AUTH_PROG
  /

do not need to add ; or other things, its available for all users who are trying to accesss database with third parties tools. You can inculde formbuilder (builder and runing) program name in procedure.

Best of Luck and remember me in your prayer.


No comments:

Post a Comment