空闲3分钟自动断开
SELECT * FROM DBA_PROFILES; CREATE PROFILE KILLIDLE LIMIT IDLE_TIME 3; alter PROFILE DEFAULT LIMIT IDLE_TIME 3;
有必要还可以根据业务修改连接时长,超过多少时间就干掉连接
alter PROFILE DEFAULT LIMIT CONNECT_TIME UNLIMITED;
一些辅助命令查进程和session
select count(*) from v$process; select count(*) from v$session; select max(pga_used_mem)/1024/1024 M from v$process; select min(pga_used_mem)/1024/1024 M from v$process where pga_used_mem>0;
select a.USERNAME,a.MACHINE, sql_text,'alter system kill session '''||a.SID||','||a.SERIAL#||',@'||a.INST_ID||''';' ,status
from gV$session a inner join GV$sql b on a.sql_id=b.sql_id
WHERE status = 'ACTIVE'