[置顶] oracle DBA 脚本记录

1、查询各个segment的大小
select s.owner, ROUND(SUM(S.BYTES) / 1024 / 1024, 1) size_M, 'Mb' MB
  from dba_segments s
 WHERE S.OWNER IN
       (SELECT USERNAME
          FROM DBA_USERS
         WHERE USERNAME NOT IN ('SYS', 'SYSTEM', 'OUTLN', 'PERFSTAT'))
 GROUP BY s.owner
 order by size_M desc


 2、

delete from a where id=1 returning uin into p_uin


 3、查询system表空间哪个段占用空间最多

select segment_name, sum(bytes)/1024/1024 Mbytese from dba_segments 
where tablespace_name='SYSTEM'
group by segment_name 
order by Mbytese desc ;


 4、查询WEB服务占用的session数量

select * from v$session t where t.MACHINE='WORKGROUP\SLBGSTOREWEB'


 

 

你可能感兴趣的:([置顶] oracle DBA 脚本记录)