REM UserKill.sql
REM
REM
col C1 for A10 head UserID
set verify off
prompt Enter a username (return=all)
select SID,serial#,SID||','||serial# C1,username,status
from v$session
where username like upper('&username%')
/
prompt Now kill the user: (return = kill no users)
alter system kill session '&UserID'
/
select SID,serial#,username,status
from v$session
where username = upper('&username')
/
undefine username
[실행 예]
----------------------
Session 1 (scott/tiger로 접속)
----------------------
SQL>conn scott/tiger
SQL>
----------------------
Session 2 (sys user로 접속)
----------------------
SQL> @UserKill
Enter a username (return=all)
Enter value for username: scott
SID SERIAL# UserID USERNAME
STATUS
---------- ---------- ---------- ------------------------------
--------
12 4 12,4 SCOTT
INACTIVE
Now kill the user: (return = kill no users)
Enter value for userid: 12,4
System altered.
Enter value for username:
--------------------------
Session 1
--------------------------
SQL> select * from tab;
select * from tab
*
ERROR at line 1:
ORA-00028: your session has been killed
댓글 없음:
댓글 쓰기