查詢sql
select sess.sid,
sess.serial#,
lo.oracle_username,
lo.os_user_name,
ao.object_name,
lo.locked_mode
from v$locked_object lo, dba_objects ao, v$session sess, v$process p
where ao.object_id = lo.object_id
and lo.session_id = sess.sid;
原因
select l.session_id sid,
s.serial#,
l.locked_mode,
l.oracle_username,
s.user#,
l.os_user_name,
s.machine,
s.terminal,
a.sql_text,
a.action
from v$sqlarea a, v$session s, v$locked_object l
where l.session_id = s.sid
and s.prev_sql_addr = a.address
order by sid, s.serial#;
ORACLE解鎖的方法
alter system kill session ’146′; –146為鎖住的進程號赴魁,即spid
查看當(dāng)前的數(shù)據(jù)庫連接數(shù)
select count(*) from v$process ; --當(dāng)前的數(shù)據(jù)庫連接數(shù)
數(shù)據(jù)庫允許的最大連接數(shù)
select value from v$parameter where name ='processes'; --數(shù)據(jù)庫允許的最大連接數(shù)
查看當(dāng)前有哪些用戶正在使用數(shù)據(jù)
select osuser, a.username, cpu_time/executions/1000000||'s', b.sql_text, machine
from v$session a, v$sqlarea b
where a.sql_address =b.address
order by cpu_time/executions desc; --查看當(dāng)前有哪些用戶正在使用數(shù)據(jù)
當(dāng)前的session連接數(shù)
select count(*) from v$session --當(dāng)前的session連接數(shù)
當(dāng)前并發(fā)連接數(shù)
select count(*) from v$session where status='ACTIVE'; --并發(fā)連接數(shù)