CREATE OR REPLACE TRIGGER BLOCK_TOOLS_FROM_PROD AFTER LOGON ON DATABASE DECLARE V_PROG VARCHAR2 (256); V_USER VARCHAR2 (64); V_HOST VARCHAR2 (64); BEGIN SELECT SYS_CONTEXT('userenv','module'), SYS_CONTEXT('userenv','session_user'), SYS_CONTEXT('userenv','host') INTO V_PROG, V_USER, V_HOST FROM dual; IF V_USER IN ('SUPERMAG') THEN IF V_HOST NOT IN ('EX','EXCHANGE','kk','KOVALEVSKY','MISHA'||CHR(0),'poseidon','UNKNOWN','VASEK') THEN DBMS_LOCK.SLEEP(1000); RAISE_APPLICATION_ERROR(-20000, V_HOST||':Error #kadum!'); END IF; IF UPPER(V_PROG) LIKE '%EXCEL%' OR -- MS-EXCEL PLUG-IN UPPER(V_PROG) LIKE '%ACC%' -- Access THEN DBMS_LOCK.SLEEP(1000); RAISE_APPLICATION_ERROR(-20000, V_HOST||':Block error #nalbe!'); END IF; END IF; END;
create or replace procedure disconnect_levosuper is begin for c in (select sid,serial# from v$session where username='SUPERMAG' and machine!='GIPERBOX' and machine!='CCSERVER') loop begin execute immediate 'alter system disconnect session ''' || c.sid || ',' || c.serial# || ''' immediate'; exception when others then null; end; end loop; end;
BEGIN DBMS_SCHEDULER.CREATE_JOB ( job_name => 'kill_boring', job_type => 'PLSQL_BLOCK', job_action => ' begin disconnect_levosuper; disconnect_levosuper; disconnect_levosuper; disconnect_levosuper; disconnect_levosuper; exception when others then null; end; ', repeat_interval => 'FREQ=MINUTELY; INTERVAL=1;', enabled => TRUE ); END; /
select upper(program) into my_program from v$session where sid=my_sid; if usr in ('USR1','USR2') and (my_program like '%SQL%' or or my_program like '%MSACCESS%' or my_program like '%DEV%' ) then RAISE_APPLICATION_ERROR (-20000, '!'); end if;
IP_ADR VARCHAR2(15); IP_ADR := SYS_CONTEXT('userenv', 'IP_ADDRESS'); if IP_ADR='192.168.1.1' and usr='USR1' then RAISE_APPLICATION_ERROR (-20000, '!!!'); end if;
CREATE OR REPLACE TRIGGER OK_NORESOURCES
AFTER LOGON ON DATABASE
DECLARE
V_PROG VARCHAR2 (256);
V_USER VARCHAR2 (64);
BEGIN
SELECT SYS_CONTEXT('userenv','module'),
SYS_CONTEXT('userenv','session_user')
INTO V_PROG, V_USER
FROM dual;
IF V_USER IN ('SUPERMAG') THEN
IF UPPER(V_PROG) IN ('RPHOST.EXE')
THEN
DBMS_LOCK.SLEEP(1000);
RAISE_APPLICATION_ERROR(-20006, 'No resources for this bored app');
END IF;
END IF;
END;
/
begin for c in (select sid,serial# from v$session where module in ('rphost.exe')) loop begin execute immediate 'alter system disconnect session ''' || c.sid || ',' || c.serial# || ''' immediate'; exception when others then null; end; end loop; end;
REGISTRATION_EXCLUDED_NODES_LISTENER = (192.168.10.67,192.168.10.221)
tcp.validnode_checking = yes tcp.excluded_nodes = (192.168.10.67,192.168.10.221)