Posted By

mifly on 03/01/10


Tagged

Oracle


Versions (?)

ORACLE 获取表所占用空间大小计算和展示


 / Published in: SQL
 

  1. SELECT s.segment_name,
  2. decode(SUM(BYTES), NULL, 0, SUM(BYTES) / 1024)
  3. FROM DBA_SEGMENTS S, dba_tables t
  4. WHERE s.owner = 'you segment owner'
  5. AND t.owner = 'your table owner'
  6. AND s.segment_name = t.table_name
  7. AND s.blocks IS NOT NULL
  8. AND s.blocks > 0
  9. GROUP BY s.segment_name
  10. HAVING SUM(BYTES) > 0
  11.  
  12. 其中有些表的大小为表初始大小,尽管数据行为0,也能包含在其中,因为之前的行被删除,高水位线没下来。

Report this snippet  

You need to login to post a comment.