Oracle死锁、数据库链接问题

时间:2022-11-18 03:12:54

--查询数据库锁表的信息

select do.object_name,t2.username,t2.sid,t2.serial#,t2.logon_time,t2.MACHINE,t2.state,t2.STATUS
from v$locked_object t1,v$session t2,dba_objects do
where t2.STATUS='INACTIVE' and t1.session_id=t2.sid and do.object_id=t1.OBJECT_ID order by t2.logon_time;

--杀掉锁表的记录

alter system kill session '119,3721';

--查看占用连接数

select * from v$session where username='RIM_UAT' and status <>'KILLED'

--并发连接数

select count(*) from v$session where status='ACTIVE'