2014년 3월 9일 일요일

oracle user kill 사용자 세션 죽이기 (오라클 세션 KILL, 사용자세션KILL), 세션오라클강좌,ORACLE SESSION강좌, SESSION KILL

oracle user kill 사용자 세션 죽이기 (오라클 세션 KILL, 사용자세션KILL), 세션오라클강좌,ORACLE SESSION강좌, SESSION KILL

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:

댓글 없음:

댓글 쓰기