DB - Oracle-system用戶經常使用SQL

鏈接數查看
selectusername, t.MACHINE,count(username)
fromv$session t
whereusername ='DPMUSER'andstatus ='ACTIVE'
groupbyusername,t.MACHINE
orderbyMACHINE,count(username)desc;
鏈接登入狀況
Selectt.LOGON_TIMEfromv$session twherestatus ='INACTIVE'ANDusername ='DPMUSER'ORDERBYT.LOGON_TIMEDESC;
查看鎖
selectowner,namemode_held,count(*)
fromdba_dml_locks
groupbyowner,name, mode_heldorderbyowner;
查看鎖
SELECT/*+rule*/
s.username,
decode(l.type,'TM','DML enqueue','TX','Transaction enqueue',NULL) LOCK_LEVEL,
o.owner,
o.object_name,
o.object_type,
s.sid,
s.serial#,
s. terminal,
s.machine,
s.program,
s.osuser
FROMv$session s, v$lock l, dba_objects o
WHEREl.sid = s.sid
ANDl.id1 = o.object_id(+)
ANDs.usernameisNOTNULL
orderbysid;
解鎖
select'alter system kill session '''|| sid ||','|| serial# ||
''' IMMEDIATE;'--,
-- t.logon_time, t.*
fromv$session t
where/* t.logon_time > sysdate -10/24/60
and*/
username ='MEMBERUSER';
檢查是否有block的session
select*fromdba_blockers;
select*fromdba_waiters;
相關文章
相關標籤/搜索