Oracle會話查詢等

如何查看oracle當前連接數,會話數 收藏
查看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' #併發連接數
 

先查看哪些表被鎖住了

select b.owner,b.object_name,a.session_id,a.locked_mode
from v$locked_object a,dba_objects b
where b.object_id = a.object_id;

 
select b.username,b.sid,b.serial#,logon_time 
from v$locked_object a,v$session b
where a.session_id = b.sid order by b.logon_time;
 
殺會話

alter system kill session 'sid,serial#';

 

1.查哪個過程被鎖
查V$DB_OBJECT_CACHE視圖:
SELECT * FROM V$DB_OBJECT_CACHE WHERE OWNER='過程的所屬用戶' AND CLOCKS!='0';

2. 查是哪一個SID,通過SID可知道是哪個SESSION.
查V$ACCESS視圖:
SELECT * FROM V$ACCESS WHERE OWNER='過程的所屬用戶' AND NAME='剛纔查到的過程名';

3. 查出SID和SERIAL#
查V$SESSION視圖:
SELECT SID,SERIAL#,PADDR FROM V$SESSION WHERE SID='剛纔查到的SID'
查V$PROCESS視圖:
SELECT SPID FROM V$PROCESS WHERE ADDR='剛纔查到的PADDR';

4. 殺進程
(1).先殺ORACLE進程:
ALTER SYSTEM KILL SESSION '查出的SID,查出的SERIAL#';
(2).再殺操作系統進程:
KILL -9 剛纔查出的SPID

ORAKILL 剛纔查出的SID 剛纔查出的SPID

 

發佈了133 篇原創文章 · 獲贊 43 · 訪問量 144萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章