ORACLE SQL的查詢表的鎖的情況

zhengbao_jun發表於2012-02-27

查詢sql的歷史記錄

select * from v$sqlarea t where t.PARSING_SCHEMA_NAME in ('使用者名稱') order by t.LAST_ACTIVE_TIME desc
select * from v$sqlarea t order by t.LAST_ACTIVE_TIME desc

檢視一段時間內的執行情況

select * from v$sqlarea t where ( to_char(t.LAST_ACTIVE_TIME,'yyyy-mm-dd hh24:mi:ss') > '2011-12-28 14:11:39' ) and (to_char(t.LAST_ACTIVE_TIME,'yyyy-mm-dd hh24:mi:ss') < '2011-12-28 14:11:43') order by t.LAST_ACTIVE_TIME desc

查詢當前時間

select sysdate from dual

查詢鎖表的情況

select * from v$locked_object;
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;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/235507/viewspace-717194/,如需轉載,請註明出處,否則將追究法律責任。

相關文章