Posted on 2011-05-31 13:04
贺荣心 阅读(348)
评论(0) 编辑 收藏 所属分类:
oracle
1
--查询当前会话和相关进程信息的SQL语句
2select s.saddr,
3 s.sid,
4 s.serial#,
5 s.paddr,
6 s.username,
7 s.status,
8 s.osuser,
9 s.process,
10 s.machine,
11 s.program,
12 s.type,
13 s.action,
14 s.logon_time,
15 p.pga_used_mem,
16 p.pga_alloc_mem
17 from v$session s, v$process p
18 where s.PADDR = p.ADDR
19 order by sid
20
21 --查询当前会话等待情况及对应进程信息的SQL语句
22 select s.SID,
23 s.SERIAL#,
24 s.PADDR,
25 s.PROGRAM,
26 s.ACTION,
27 s.TYPE,
28 s.MACHINE,
29 s.SCHEMANAME,
30 s.USERNAME,
31 s.STATUS,
32 w.SEQ#,
33 w.EVENT,
34 w.SECONDS_IN_WAIT,
35 w.STATE
36 from v$session s, v$session_wait w
37 where s.sid = w.sid
38 order by s.sid
39
40 --查看SQL语句执行效率的语句
41 select sql_text,
42 executions,
43 fetches,
44 parse_calls,
45 disk_reads,
46 buffer_gets,
47 optimizer_mode,
48 cpu_time,
49 elapsed_time
50 from v$sql
51 order by cpu_time desc, executions desc