Alter System Kill Session Not Working
746534Jan 14 2010 — edited Jan 14 2010I'm not certain as to what the problem may be, but the following code does not work in that the session is not being disconnected.
The attempt is to have this trigger kill a user's logon session if the user is attempting to run a program named 'ex_oc.exe'
I've tested the code (getting the values back to the table as expected) and it appears to be working but it doesn't execute.
I've also tried ''ALTER SYSTEM DISCONNECT SESSION'.
Database is 11g.
Any ideas?
Thanks
CREATE OR REPLACE TRIGGER SYS.DENY_MSB_TRIGGER_UPDATEDD
AFTER LOGON ON Database
DECLARE
v_programname varchar2(64);
v_logontime date;
v_process varchar2(24);
v_machine varchar2(64);
v_sid number;
v_serialnum number;
v_username varchar2(30);
v_stmt2run VARCHAR2(327);
cur INTEGER;
ret INTEGER;
v_string VARCHAR2(500);
BEGIN
SELECT PROGRAM, PROCESS, MACHINE, SID, SERIAL#, USERNAME
INTO v_programname, v_process, v_machine, v_sid, v_serialnum, v_username
FROM V$SESSION
WHERE PROGRAM = LOWER('ex_oc.exe');
INSERT INTO SAUDIT.DENYMSB (PROGRAM, PROCESS, MACHINE, SID, SERIALNUM, USERNAME)
VALUES (v_programname, v_process, v_machine, v_sid, v_serialnum, v_username );
v_string := 'ALTER SYSTEM KILL SESSION' || CHR(39)||v_sid||','||v_serialnum|| CHR(39)||' IMMEDIATE';
EXECUTE IMMEDIATE v_string;
END;
Edited by: user12451703 on Jan 14, 2010 8:57 AM
Edited by: user12451703 on Jan 14, 2010 8:58 AM