用于监控Session、process、Lock的几个SQL语句

文章转自:http://www.blogjava.net/herongxin/archive/2011/05/31/351416.html

1 --查询当前会话和相关进程信息的SQL语句

 

1 select s.saddr,s.sid,s.serial#,s.paddr,s.username,s.status,s.osuser,s.process,s.machine,s.program,s.type,s.action,s.logon_time,p.pga_used_mem,p.pga_alloc_mem

2 from v$session s, v$process p

3 where s.PADDR = p.ADDR

4 orderby sid

2--查询当前会话等待情况及对应进程信息的SQL语句

 

1 select s.SID,s.SERIAL#,s.PADDR, s.PROGRAM,s.ACTION,s.TYPE,s.MACHINE,s.SCHEMANAME,s.USERNAME,s.STATUS,w.SEQ#,w.EVENT,w.SECONDS_IN_WAIT,

2 w.STATE

3 from v$session s, v$session_wait w

4 where s.sid = w.sid

5 orderby s.sid

3 --查看SQL语句执行效率的语句

 

1 select sql_text,executions,fetches, parse_calls,disk_reads,buffer_gets,optimizer_mode,cpu_time,elapsed_time

2 from v$sql

3 orderby cpu_time desc, executions desc

 

 

 

你可能感兴趣的:(session)