Oracle管理专题之:用于监控Session、process、Lock的几个SQL语句

来源:互联网 发布:安卓微信数据恢复大师 编辑:程序博客网 时间:2024/06/05 15:40

 --查询当前会话和相关进程信息的SQL语句
 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
   from v$session s, v$process p
  where s.PADDR = p.ADDR
  order by sid

 --查询当前会话等待情况及对应进程信息的SQL语句
 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,
       w.STATE
  from v$session s, v$session_wait w
 where s.sid = w.sid
 order by s.sid

 --查看SQL语句执行效率的语句
 select sql_text,
       executions,
       fetches,
       parse_calls,
       disk_reads,
       buffer_gets,
       optimizer_mode,
       cpu_time,
       elapsed_time
  from v$sql
 order by cpu_time desc, executions desc

 

原创粉丝点击