SQL> select B.SEGMENT_NAME, B.blocks,B.blocks * 8096 / 1024 / 1024, A.BLOCKS,A.blocks * 8096 / 1024 / 1024, A.EMPTY_BLOCKS from user_tables a,
USER_SEGMENTS B WHERE TABLE_NAME in ('TEST_1','TEST_2') AND A.TABLE_NAME = B.SEGMENT_NAME;
SEGMENT_NAME BLOCKS B.BLOCKS*8096/1024/1024 BLOCKS A.BLOCKS*8096/1024/1024 EMPTY_BLOCKS
--------------------------------------------------------------------------------- ---------- ----------------------- ---------- ----------------------- ------------
TEST_1 64512 498.09375 222 1.71405029 0
TEST_2 64512 498.09375 222 1.71405029 0
SQL> select TABLE_NAME,BLOCKS,EMPTY_BLOCKS from user_tables where table_name in ('TEST_1','TEST_2');
TABLE_NAME BLOCKS EMPTY_BLOCKS
------------------------------ ---------- ------------
TEST_1 222 0
TEST_2 222 0
SQL> select owner,segment_name,sum(bytes)/1024/1024 MB from dba_segments where tablespace_name='TEST' and segment_type like '%TAB%' group by owner,segment_name order by MB desc;
OWNER SEGMENT_NAME MB
------------------------------ --------------------------------------------------------------------------------- ----------
ADMIN TEST_2 504
ADMIN TEST_1 504
SQL> select index_name,table_name,status from user_indexes where table_name in ('TEST_1','TEST_2'); ---索引状态都正常
INDEX_NAME TABLE_NAME STATUS
------------------------------ ------------------------------ --------
IDX_TEST2 TEST_2 VALID
IDX_TEST1 TEST_1 VALID
SQL>
----从上面可以看出,由于我们预分配给了两张表500M,那么他们俩现在一共有64512个blocks,共有500M,而实际只占用了222个,
4、删除两张表的数据,并收集统计信息然后查看两张表的blocks信息: