1.Monitor Current SQL Running(10g)

tolilong發表於2016-01-26
如下是Oracle10g Monitor Current SQL Running Script:

select vs.LAST_CALL_ET elapsed_time,vs.SID,vs.SERIAL#,vp.SPID,vs.USERNAME,vs.OSUSER,vs.MACHINE,
vs.EVENT,vs.PROGRAM,vs.MODULE,vs.SQL_ID,vsql.SQL_TEXT,vsql.SQL_FULLTEXT,vs.SCHEMANAME,vs.STATUS,vsql.EXECUTIONS,
(select value from v$sesstat where sid=vs.SID and statistic#=10 and rownum=1)  "logical reads",  --session logical reads
(select value from v$sesstat where sid=vs.SID and statistic#=59 and rownum=1)  "physical reads", --physical reads
(select value from v$sesstat where sid=vs.SID and statistic#=64 and rownum=1)  "block changes", --db block changes 
(select value from v$sesstat where sid=vs.SID and statistic#=3 and rownum=1)  "opened cursors current",  --opened cursors current
(select value from v$sesstat where sid=vs.SID and statistic#=26 and rownum=1)  "session pga memory",  --session pga memory
vsql.COMMAND_TYPE,vsql.PLAN_HASH_VALUE,vs.ACTION,vs.LOGON_TIME,vs.TYPE,vs.SQL_HASH_VALUE,
vs.SADDR,vs.P1,vs.P2,vs.P3
from v$session vs,v$sqlarea vsql,v$process vp 
where vs.SQL_ID=vsql.SQL_ID and vs.PADDR=vp.ADDR and vs.status='ACTIVE' order by 1 desc  

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

相關文章