Está en la página 1de 1

How to prevent users using TOAD connecting to Oracle server from their client This is a discussion on How to prevent

users using TOAD connecting to Oracle ser ver from their client; Because of your database security, you don't want some cl ient login to Oracle server using TOAD(or others software). This show how to cre ate a system trigger to prevent the connection as you need: CREATE OR REPLACE TRIGGER prevent_users_login AFTER LOGON ON DATABASE DECLARE CURSOR cur_session IS SELECT PROGRAM, USERNAME, SCHEMANAME, OSUSER FROM v$session WHERE audsid=sys_context('USERENV','SESSIONID'); rec_session cur_session%ROWTYPE; BEGIN OPEN cur_session; FETCH cur_session INTO rec_session; IF SUBSTR(rec_session.program,1,4) = 'TOAD' AND rec_session.OSUSER IN ('user_a', 'user_b', 'user_c') AND rec_session.SCHEMANAME LIKE 'XYZ%' THEN RAISE_APPLICATION_ERROR(-20001, 'You are not allowed to login'); END IF; CLOSE cur_session; END; =======================================================

Today, I ve seen a nice example at www.psoug.org on how to prevent users from usin g additional tools to connect to production database. This is the AFTER LOGON tr igger create ON DATABASE as follows: CONNECT / AS SYSDBA; CREATE OR REPLACE TRIGGER block_tools_from_prod AFTER LOGON ON DATABASE DECLARE v_prog sys.v_$session.program%TYPE; BEGIN SELECT program INTO v_prog FROM sys.v_$session WHERE audsid = USERENV('SESSIONID') AND audsid != 0 -- Don't Check SYS Connections AND ROWNUM = 1; -- Parallel processes will have the same AUDSID's IF UPPER(v_prog) LIKE '%TOAD%' OR UPPER(v_prog) LIKE '%T.O.A.D%' OR -- Toad UPPER(v_prog) LIKE '%SQLNAV%' OR -- SQL Navigator UPPER(v_prog) LIKE '%PLSQLDEV%' OR -- PLSQL Developer UPPER(v_prog) LIKE '%BUSOBJ%' OR -- Business Objects UPPER(v_prog) LIKE '%EXCEL%' -- MS-Excel plug-in THEN RAISE_APPLICATION_ERROR(-20000, 'Development tools are not allowed here.'); END IF; END; / SHOW ERRORS http://www.psoug.org/snippet/Block_TOAD_and_other_tools_516.htm

También podría gustarte