Chinaunix首页 | 论坛 | 博客
  • 博客访问: 793405
  • 博文数量: 180
  • 博客积分: 4447
  • 博客等级: 上校
  • 技术积分: 1582
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-03 14:51
文章分类

全部博文(180)

文章存档

2014年(6)

2013年(8)

2011年(125)

2009年(35)

2008年(1)

2007年(5)

分类: Oracle

2011-01-05 17:18:43

1.查看session的SQL
  1. col machine format a10
  2. col username format a10
  3. select sid,serial#,username,machine,server,paddr,status from v$session;
2.是否存在一个进程多个会话呢?
  1. sys@TEST15> l
  2.   1* select sid,serial#,username,machine,server,paddr,status from v$session
  3. sys@TEST15> set autotrace on statistics
  4. sys@TEST15> /

  5.        SID SERIAL# USERNAME MACHINE SERVER PADDR STATUS
  6. ---------- ---------- ---------- ---------- --------- -------- --------
  7.        138 1 CESTOS5.4 DEDICATED 2A21F6C4 ACTIVE
  8.        140 1 CESTOS5.4 DEDICATED 2A21F110 ACTIVE
  9.        146 7 CESTOS5.4 DEDICATED 2A21E5A8 ACTIVE
  10.        147 14 SYS CESTOS5.4 DEDICATED 2A21BDBC INACTIVE
  11.        152 1 CESTOS5.4 DEDICATED 2A21DA40 ACTIVE
  12.        153 1 CESTOS5.4 DEDICATED 2A21D48C ACTIVE
  13.        154 1 CESTOS5.4 DEDICATED 2A21CED8 ACTIVE
  14.        155 1 CESTOS5.4 DEDICATED 2A21C924 ACTIVE
  15.        156 1 CESTOS5.4 DEDICATED 2A21C370 ACTIVE
  16.        159 6 SYS CESTOS5.4 DEDICATED 2A21BDBC ACTIVE
  17.        160 1 CESTOS5.4 DEDICATED 2A21A138 ACTIVE
  18.        161 1 CESTOS5.4 DEDICATED 2A219B84 ACTIVE
  19.        162 1 CESTOS5.4 DEDICATED 2A2195D0 ACTIVE
  20.        163 1 CESTOS5.4 DEDICATED 2A21901C ACTIVE
  21.        164 1 CESTOS5.4 DEDICATED 2A218A68 ACTIVE
  22.        165 1 CESTOS5.4 DEDICATED 2A2184B4 ACTIVE
  23.        166 1 CESTOS5.4 DEDICATED 2A217F00 ACTIVE
  24.        167 1 CESTOS5.4 DEDICATED 2A21794C ACTIVE
  25.        168 1 CESTOS5.4 DEDICATED 2A217398 ACTIVE
  26.        169 1 CESTOS5.4 DEDICATED 2A216DE4 ACTIVE
  27.        170 1 CESTOS5.4 DEDICATED 2A216830 ACTIVE

  28. 21 rows selected.


  29. Statistics
  30. ----------------------------------------------------------
  31.           0 recursive calls
  32.           0 db block gets
  33.           0 consistent gets
  34.           0 physical reads
  35.           0 redo size
  36.        1261 bytes sent via SQL*Net to client
  37.         396 bytes received via SQL*Net from client
  38.           3 SQL*Net roundtrips to/from client
  39.           0 sorts (memory)
  40.           0 sorts (disk)
  41.          21 rows processed
我们打开了autotrace发现了,2个会话PADDR一样,说明他们是一个进程的。在这里应该是一个select 和一个autotrace产生的会话。

3.会话与连接
会话出现在v$session视图中,而连接出现在v$process视图中,当sqlplus 中执行 disconnect 命令实际上是取消了会话,但是在v$process中连接没有取消,可以用过connect 再创建会话,只有输入exit后,会话才被取消。我们可以通过v$session视图的paddr和v$process的addr来查看会话与连接的关系
我整理了个SQL来查看会话与连接的对应关系
  1. select b.username osuser,a.username orauser,a.sid,a.serial#,a.machine,a.server,b.addr,b.program,a.status from v$session a ,v$process b where a.paddr( )=b.addr;

4.查看后台进程,有paddr的正在使用的后台进程
  1. select paddr, name, description from v$bgprocess order by paddr desc;





























阅读(1497) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~