Chinaunix首页 | 论坛 | 博客
  • 博客访问: 734509
  • 博文数量: 803
  • 博客积分: 6000
  • 博客等级: 准将
  • 技术积分: 5015
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-28 10:29
文章分类

全部博文(803)

文章存档

2011年(1)

2008年(802)

我的朋友

分类:

2008-10-29 11:43:47


  v$session 视图的一个不太有名的特性是它能够解码由单个会话执行的实际命令。信息被编码到一个特殊的字段 v$session_command。
  
  在查询 v$session 视图的时候,我们根据它的内部表示解码每一个字段。这样我们就可以创建一个数据字典查询,使用这个数据字典来显示每一个用户、这些用户在执行的程序,以及在这些用户的系统中正在执行的程序内部当前的命令。
  
  当你需要快速找出他们的 系统的内部情况时非常有用。
  
  这个简单的脚本举例说明了 v$session_command。
  
  select
  substr(s.username,1,18) username,
  substr(s.program,1,15) program,
  decode(s.command,
  0,'No Command',
  1,'Create Table',
  2,'Insert',
  3,'Select',
  6,'Update',
  7,'Delete',
  9,'Create Index',
  15,'Alter Table',
  21,'Create View',
  23,'Validate Index',
  35,'Alter Database',
  39,'Create Tablespace',
  41,'Drop Tablespace',
  40,'Alter Tablespace',
  53,'Drop User',
  62,'Analyze Table',
  63,'Analyze Index',
  s.command||': Other') command
  from
  v$session   s,
  v$process   p,
  v$transaction t,
  v$rollstat  r,
  v$rollname  n
  where s.paddr = p.addr
  and  s.taddr = t.addr (+)
  and  t.xidusn = r.usn (+)
  and  r.usn = n.usn (+)
  order by
  
【责编:admin】

--------------------next---------------------

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