ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 常用(一)

常用(一)

原创 Linux操作系统 作者:yellowlee 时间:2009-08-01 11:02:38 0 删除 编辑

--当前连接客户端和sql
select a.SID,a.USER#,a.USERNAME,a.OSUSER,a.MACHINE,b.SQL_TEXT,b.ADDRESS
 from v$session a,v$open_cursor b where a.SID = b.SID
and a.STATUS = 'ACTIVE' and a.USERNAME is not null;

--当前连接信息
select *
  from v$session a, v$session_connect_info b, v$lock c, v$open_cursor d
 where a.SID = b.SID
   and a.SID = c.SID
   and a.SID = d.SID
   and a.USERNAME is not null
    ;

/*当前连接数量,可做成实时刷新,生成连接曲线图*/
select sysdate day, INSTANCE_NAME,
      machine, username, count(*) conncount
  from v$session, v$instance
  group by machine, username, instance_name ;

--查看锁状态
SELECT S.SID SESSION_ID,
       s.MACHINE,
       s.USER#,
       s.SERIAL#,
       S.USERNAME,
       DECODE(LMODE,
              0,
              'None',
              1,
              'Null',
              2,
              'Row-S   (SS)',
              3,
              'Row-X   (SX)',
              4,
              'Share',
              5,
              'S/Row-X   (SSX)',
              6,
              'Exclusive',
              TO_CHAR(LMODE)) MODE_HELD,
       DECODE(REQUEST,
              0,
              'None',
              1,
              'Null',
              2,
              'Row-S   (SS)',
              3,
              'Row-X   (SX)',
              4,
              'Share',
              5,
              'S/Row-X   (SSX)',
              6,
              'Exclusive',
              TO_CHAR(REQUEST)) MODE_REQUESTED,
       O.OWNER || '.' || O.OBJECT_NAME || '   (' || O.OBJECT_TYPE || ')',
       S.TYPE LOCK_TYPE,
       L.ID1 LOCK_ID1,
       L.ID2 LOCK_ID2
  FROM V$LOCK L, SYS.DBA_OBJECTS O, V$SESSION S
 WHERE L.SID = S.SID
   AND L.ID1 = O.OBJECT_ID;


/* librarycache详细*/
select namespace,
       gets,
       gethits,
       gethitratio,
       pins,
       pinhits,
       pinhitratio,
       reloads,
       invalidations
  from v$librarycache;

/*librarycache命中率*/
Select sum(pinhits),
  sum(pins),
  sum(pinhits)/sum(pins) "librarycache hit ratio"
  from v$librarycache;

 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16179598/viewspace-611033/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 燃情岁月
请登录后发表评论 登录
全部评论

注册时间:2008-12-27

  • 博文量
    316
  • 访问量
    656231