oracle常用技巧

1、查看连接数
select count(*)from v$process s
2、查看每台机器的session数
select count(*),machine  from v$session group by machine
3、查看系统设定的最大连接数
select value from v$parameter where name = 'processes'
4、查看锁定的表
select * from V$LOCKED_OBJECT
5、查看所有执行的sql语句
select * from v$sqlarea
where
last_active_time > TO_DATE('2010-09-20', 'yyyy-MM-dd')
6、查看占用资源大的语句
select sql_text ,sharable_mem from v$sql where sharable_mem > '100000' order by sharable_mem ;
7、查看每天机器打开的游标数
select count(v2.MACHINE) as countp, v2.MACHINE
  from v$open_cursor v1
  left join v$session v2 on v1.SID = v2.SID
 group by v2.MACHINE
 order by countp desc;
8、查看系统的运行时间
select to_char(startup_time, 'DD-MON-YYYY HH24:MI:SS') started_at,
       TRUNC(sysdate - (startup_time)) || 'day(s),' ||
       TRUNC(24 *
             ((sysdate - startup_time) - TRUNC(sysdate - startup_time))) ||
       'hour(s),' || MOD(TRUNC(1440 * ((SYSDATE - startup_time) -
                               TRUNC(sysdate - startup_time))),
                         60) || 'minutes(s),' ||
       MOD(TRUNC(86400 *
                 ((SYSDATE - STARTUP_TIME) - TRUNC(SYSDATE - startup_time))),
           60) || 'seconds' uptime
  from v$instance;

 

你可能感兴趣的:(oracle,职场,休闲)