如何查看oracle当前连接数,会话数
Select count(*) from v$session where status='ACTIVE' #并发连接数
原文链接:https://www.f2er.com/oracle/207558.html
查看session:
select * from v$session where username is not null
select username,count(username) from v$session where username is not null group by username
当前连接数:
select count(*) from v$process
查看连接数参数的设置情况
select value from v$parameter where name = 'processes'
Select count(*) from v$session where status='ACTIVE' #并发连接数
先查看哪些表被锁住了
selectb.owner,b.object_name,a.session_id,a.locked_mode
fromv$locked_objecta,dba_objectsb
whereb.object_id=a.object_id;
selectb.username,b.sid,b.serial#,logon_time
fromv$locked_objecta,v$sessionb
wherea.session_id=b.sidorderbyb.logon_time;
fromv$locked_objecta,v$sessionb
wherea.session_id=b.sidorderbyb.logon_time;
杀会话
altersystemkillsession'sid,serial#';
1.查哪个过程被锁
查V$DB_OBJECT_CACHE视图:
SELECT*FROMV$DB_OBJECT_CACHEWHEREOWNER='过程的所属用户'ANDCLOCKS!='0';
2.查是哪一个SID,通过SID可知道是哪个SESSION.
查V$ACCESS视图:
SELECT*FROMV$ACCESSWHEREOWNER='过程的所属用户'ANDNAME='刚才查到的过程名';
3.查出SID和SERIAL#
查V$SESSION视图:
SELECTSID,SERIAL#,PADDRFROMV$SESSIONWHERESID='刚才查到的SID'
查V$PROCESS视图:
SELECTSPIDFROMV$PROCESSWHEREADDR='刚才查到的PADDR';
4.杀进程 (1).先杀ORACLE进程: ALTERSYSTEMKILLSESSION'查出的SID,查出的SERIAL#'; (2).再杀操作系统进程: KILL-9刚才查出的SPID 或 ORAKILL刚才查出的SID刚才查出的SPID