How to kill all active and inactive oracle sessions for user

后端 未结 6 902
北海茫月
北海茫月 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:08

    For Oracle 11g this may not work as you may receive an error like below

    Error report:
    SQL Error: ORA-00026: missing or invalid session ID
    00026. 00000 -  "missing or invalid session ID"
    *Cause:    Missing or invalid session ID string for ALTER SYSTEM KILL SESSION.
    *Action:   Retry with a valid session ID.
    

    To rectify this, use below code to identify the sessions

    SQL> select inst_id,sid,serial# from gv$session or v$session

    NOTE : v$session do not have inst_id field

    and Kill them using

    alter system kill session 'sid,serial,@inst_id' IMMEDIATE;
    

提交回复
热议问题