How to kill all active and inactive oracle sessions for user

后端 未结 6 999
北海茫月
北海茫月 2021-01-30 14:30

I am trying the below script to kill all active and inactive oracle sessions for user at once but it doesn\'t work. The script executes successfully but does not kill sessions f

6条回答
  •  渐次进展
    2021-01-30 15:00

    inactive session the day before kill

    begin
        for i in (select * from v$session where status='INACTIVE' and (sysdate-PREV_EXEC_START)>1)
        LOOP
            EXECUTE IMMEDIATE(q'{ALTER SYSTEM KILL SESSION '}'||i.sid||q'[,]'  ||i.serial#||q'[']'||' IMMEDIATE');
        END LOOP;
    end;

提交回复
热议问题