1. 程式人生 > >常用oracle 資料庫查詢 重要!!

常用oracle 資料庫查詢 重要!!

常用oracle 資料庫查詢:

轉載 http://blog.csdn.net/jlds123/article/details/6572559   

查詢執行過的語句:

select b.SQL_TEXT,b.FIRST_LOAD_TIME,b.SQL_FULLTEXT

  from v$sqlarea b
where b.FIRST_LOAD_TIME between '2009-10-15/09:24:47' and
       '2009-10-15/09:24:47' order by b.FIRST_LOAD_TIME
查詢前十條效能差的sql. 
SELECT * FROM (select PARSING_USER_ID,EXECUTIONS,SORTS, 
COMMAND_TYPE,DISK_READS,sql_text FROM v$sqlarea 
order BY disk_reads DESC )where ROWNUM<10 ; 
檢視佔io較大的正在執行的session 
SELECT se.sid,se.serial#,pr.SPID,se.username,se.status, 
se.terminal,se.program,se.MODULE,、se.sql_address,st.event,st. 
p1text,si.physical_reads, 
si.block_changes FROM v$session se,v$session_wait st, 
v$sess_io si,v$process pr WHERE st.sid=se.sid AND st. 
sid=si.sid AND se.PADDR=pr.ADDR AND se.sid>6 AND st. 
wait_time=0 AND st.event NOT LIKE '%SQL%' ORDER BY physical_reads DESC