Dropping a connected user from an Oracle 10g database schema

后端 未结 7 1623
情话喂你
情话喂你 2020-12-22 18:51

Is there a better way to forcefully disconnect all users from an Oracle 10g database schema than restarting the Oracle database services?

We have several developers

7条回答
  •  再見小時候
    2020-12-22 19:22

    my proposal is this simple anonymous block:

    DECLARE
       lc_username   VARCHAR2 (32) := 'user-name-to-kill-here';
    BEGIN
       FOR ln_cur IN (SELECT sid, serial# FROM v$session WHERE username = lc_username)
       LOOP
          EXECUTE IMMEDIATE ('ALTER SYSTEM KILL SESSION ''' || ln_cur.sid || ',' || ln_cur.serial# || ''' IMMEDIATE');
       END LOOP;
    END;
    /
    

提交回复
热议问题