oracle会话打满

1.查看当前连接情况

col machine for a20
col program for a40
col sql_id for a20
set linesize 300
set pagesize 300
select machine,program,sql_id,count(1) from v$session group by machine,program,sql_id order by 4 desc;

MACHINE 	     PROGRAM				      SQL_ID		     COUNT(1)
-------------------- ---------------------------------------- -------------------- ----------
WORKGROUP\HPREN      plsqldev.exe							    4
rac1		     oracle@rac1 (SCMN) 						    3
rac1		     oracle@rac1 (CLMN) 						    1
rac1		     oracle@rac1 (VKTM) 						    1
rac1		     oracle@rac1 (LMHB) 						    1
rac1		     oracle@rac1 (FENC) 						    1
rac1		     oracle@rac1 (SCM0) 						    1
rac1		     oracle@rac1 (LMON) 						    1

2.查询非活动会话

select event,machine,program,sql_id,count(1) from v$session group by event,machine,program,sql_id order by 5 desc;
1.按照machine查
SQL> select 'kill -9  ' || p.spid from v$process p where p.addr in (select a.paddr from v$session a 
where status='INACTIVE' and machine='rac1');
'KILL-9'||P.SPID
------------------------------------------------------------------
kill -9  5508
kill -9  18811
kill -9  16316
kill -9  5538
kill -9  5607
kill -9  5624
kill -9  16315


2.按主机和客户端连接程序查
SQL> select 'kill -9  ' || p.spid from v$process p where p.addr in (select a.paddr from v$session a 
where status='INACTIVE' and program='plsqldev.exe');
'KILL-9'||P.SPID
------------------------------------------------------------------
kill -9  24531
kill -9  24537


3.按客户端主机和客户端连接工具查
SQL> select 'kill -9  ' || p.spid from v$process p where p.addr in (select a.paddr from v$session a 
where status='INACTIVE' and program='plsqldev.exe' and machine='WORKGROUP\HPREN');  
'KILL-9'||P.SPID
------------------------------------------------------------------
kill -9  24531
kill -9  24537

3.杀掉会话

kill -9  5508
kill -9  18811
kill -9  16316
kill -9  5538
kill -9  5607
kill -9  5624
kill -9  16315

你可能感兴趣的:(oracle,数据库)