Wednesday, November 3, 2021

Oracle how to kill sessions by user

 BEGIN

  FOR r IN (select sid,serial# from v$session where username='COMPASS')

  LOOP

      EXECUTE IMMEDIATE 'alter system kill session ''' || r.sid  || ',' 

        || r.serial# || ''' immediate';

  END LOOP;

END;

No comments:

Post a Comment