oracle Kill 用户进程示例

查看用户会话
select t2.SPID, t1.sid, t1.username, t1.status,t1.LOGON_TIME
from v$session t1
join v$process t2 on t1.PADDR = t2.ADDR
where t1.username = 'ETL'
 and t1.status = 'ACTIVE'
 and t1.LOGON_TIME < sysdate -1

   
命令行orakill命令(ORCL即$ORACLE_SID):
select  'orakill  ORCL '|| t2.spid as command
from v$session t1
join v$process t2 on t1.PADDR = t2.ADDR
where t1.username = 'ETL'
 and t1.status = 'ACTIVE'
 and t1.LOGON_TIME < sysdate -1 

   
命令行orakill命令(针对锁进程)
SELECT 
  o.OWNER
 ,o.OBJECT_NAME
 ,l.SESSION_ID
 ,s.SERIAL# 
 ,s.LOGON_TIME
 ,p.SPID
 ,'orakill ORCL '||p.SPID as command
FROM v$locked_object l
join all_objects o on l.OBJECT_ID=o.OBJECT_ID
join v$session s on l.SESSION_ID=s.SID
join v$process p on s.PADDR = p.ADDR

你可能感兴趣的:(oracle Kill 用户进程示例)