2014년 4월 7일 월요일

오라클 세션 kill,User Session Kill[오라클개발자교육/오라클/ORACLE강좌/오라클교육잘하는곳/오라클교육추천/ORACLE실무교육/ORACLE/ORACLE교육/ORACLE학원/오라클실무교육]

오라클 세션 kill,User Session  Kill[오라클개발자교육/오라클/ORACLE강좌/오라클교육잘하는곳/오라클교육추천/ORACLE실무교육/ORACLE/ORACLE교육/ORACLE학원/오라클실무교육]


 
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:

댓글 없음:

댓글 쓰기