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

Oracle管理专题之:用于监控Session、process、Lock的几个SQL语句
 1 -- 查询当前会话和相关进程信息的SQL语句
 2 select  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


-------------------------------------------------------------
生活就像打牌,不是要抓一手好牌,而是要尽力打好一手烂牌。

你可能感兴趣的:(Oracle管理专题之:用于监控Session、process、Lock的几个SQL语句)