DBA_SEGMENTS 数据字典 块数量和发生变化情况

Oracle® Database Reference

10g Release 2 (10.2)

http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_4097.htm

DBA_SEGMENTS

DBA_SEGMENTS describes the storage allocated for all segments in the database.

Related View

USER_SEGMENTS describes the storage allocated for the segments owned by the current user's objects. This view does not display the OWNER, HEADER_FILE, HEADER_BLOCK, or RELATIVE_FNO columns.

ColumnDatatypeNULLDescription
OWNERVARCHAR2(30) Username of the segment owner
SEGMENT_NAMEVARCHAR2(81) Name, if any, of the segment
PARTITION_NAMEVARCHAR2(30) Object Partition Name (Set to NULL for non-partitioned objects)
SEGMENT_TYPEVARCHAR2(18) Type of segment: INDEX PARTITION, TABLE PARTITION, TABLE, CLUSTER, INDEX, ROLLBACK, DEFERRED ROLLBACK, TEMPORARY, CACHE, LOBSEGMENT and LOBINDEX
TABLESPACE_NAMEVARCHAR2(30) Name of the tablespace containing the segment
HEADER_FILENUMBER ID of the file containing the segment header
HEADER_BLOCKNUMBER ID of the block containing the segment header
BYTESNUMBER Size, in bytes, of the segment
BLOCKSNUMBER Size, in Oracle blocks, of the segment
EXTENTSNUMBER Number of extents allocated to the segment
INITIAL_EXTENTNUMBER Size in bytes requested for the initial extent of the segment at create time. (Oracle rounds the extent size to multiples of 5 blocks if the requested size is greater than 5 blocks.)
NEXT_EXTENTNUMBER Size in bytes of the next extent to be allocated to the segment
MIN_EXTENTSNUMBER Minimum number of extents allowed in the segment
MAX_EXTENTSNUMBER Maximum number of extents allowed in the segment
PCT_INCREASENUMBER Percent by which to increase the size of the next extent to be allocated
FREELISTSNUMBER Number of process freelists allocated to this segment
FREELIST_GROUPSNUMBER Number of freelist groups allocated to this segment
RELATIVE_FNONUMBER Relative file number of the segment header
BUFFER_POOLVARCHAR2(7) Default buffer pool for the object

我查看下表:

SELECT * from dba_segments where segment_name like 'REP_COMMON_STAT'

OWNER           ZMAS
SEGMENT_NAME    REP_COMMON_STAT
PARTITION_NAME  
SEGMENT_TYPE    TABLE
TABLESPACE_NAME ZMAS_DATA
HEADER_FILE     56
HEADER_BLOCK    449579
BYTES           6291456
BLOCKS          768
EXTENTS         21
INITIAL_EXTENT  65536
NEXT_EXTENT    
MIN_EXTENTS     1
MAX_EXTENTS     2147483645
PCT_INCREASE    
FREELISTS    
FREELIST_GROUPS    
RELATIVE_FNO    6
BUFFER_POOL     DEFAULT

HEADER_FILE 表示在哪个ID的数据文件里;

HEADER_BLOCK 表示段头块的ID号  可别认为是段的整个块数了;

分析下表

analyze table REP_COMMON_STAT compute statistics;

说明:

         为什么要收集统计信息,因为dba_tables 中的blocks 是只有收集统计信息以后才有值,而且对于empty_blocks 参数,还必须使用analyze 分析之后才有值。 如果使用dbms_stats.gather_table_stats收集,只能收集到blocks的值,empty_blocks 收集不到。

BACKED_UP    N
NUM_ROWS    58
BLOCKS      748
EMPTY_BLOCKS  19
AVG_SPACE     0
CHAIN_CNT    0
AVG_ROW_LEN    71

Dba_Segments .blocks = Dba_Tables.Blocks+Dba_Tables.Empty_Blocks +1(segment header block

这个多加的1是,是segment header block. 

如果查询的结果不是这样,可能是你没有分析表。 不妨分析表之后在查一下看看。 

这两张表对blocks 的定义也不一样:

DBA_SEGMENTS.BLOCKS holds the total number of blocks allocated to the table. 

USER_TABLES.BLOCKS holds the total number of blocks allocated for data.

删除表里的所有数据

delete rep_common_stat;
两个数据表里的信息不发生变更

trncate table rep_common_stat;

数据段的信息发生变化,数据表信息不发生变化.

BYTES        65536
BLOCKS    8
EXTENTS   1



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值