在数据库中,如何统计某个表中的数据占有的物理空间大小?

解决方案 »

  1.   

    TOAD中直接就可以看每个表空间,每个表,索引的大小
      

  2.   

    我使用的是pl/sql??如何通过语句查看??
      

  3.   

    dba_segments 
    狠一点的用 rowid 看占用了多少个 block
      

  4.   

    column db_block_size new_value blksz noprint
    select value db_block_size from v$parameter where name='db_block_size';
    column tablespace_name format a16;
    column file_name format a60;
    set linesize 160;
    select file_name,round(bytes/(1024*1024),0) total_space,autoextensible,increment_by*&blksz/(1024*1024) as incement,maxbytes/(1024*1024) as maxsize from dba_data_files order by tablespace_name;
      

  5.   

    谢谢各位!我主要是检查数据库中某个表占用的大小。比如,数据库用户user01,其中的表有tab1,tab2,tab3。
    tab1中有100万条记录,tab2中有200万条记录,tab3中有300万条记录,需要查看tab2表的200万记录占用的物理空间。
      

  6.   

    select bytes from dba_segments where segment_name = 'tab2'
      

  7.   

    dba_segments是进行静态统计,何时进行刷新?
      

  8.   

    select segment_name,sum(bytes)/1024/1024 from user_extents group by segment_name