查询数据库中的连接信息。其中SQL_COMMAND 是可以释放进程的sql语句:
select A.SID,B.SPID,A.SERIAL#,a.lockwait,A.USERNAME,A.OSUSER,a.logon_time,a.last_call_et/3600 LAST_HOUR,A.STATUS,
'orakill '||sid||' '||spid HOST_COMMAND,
'alter system kill session '''||A.sid||','||A.SERIAL#||'''' SQL_COMMAND
from v$session A,V$PROCESS B where A.PADDR=B.ADDR AND SID>6 and a.USERNAME ='SBAP';
按用户和机器名查询数据库连接情况:
SELECT username, machine, program, status, COUNT (machine) AS
连接数量
FROM v$session
GROUP BY username, machine, program, status
ORDER BY machine;
结束数据库中,某个连接的语句如下:'50,7773'是上面sql语句中的'||A.sid||','||A.SERIAL#||'
alter system kill session '50,7773'