经常在网上看到这样的语句,一直不是很理解,select tablespace_name, segment_type, owner, segment_name, partition_name FROM dba_extents WHERE file_id between block_id AND block_id + blocks – 1
这里blocks ,block_id从哪里来? 谢谢!!

解决方案 »

  1.   

    dba_extents  是一个系统视图 tablespace_name, segment_type, owner, segment_name, partition_name 
    是视图的字段 tablespace_name 表空间名称 
    segment_type  segment类型
    owner 所属用户
    ==    
      

  2.   

    blocks ,block_id 
    也是该视图的 字段 加上条件  blocks 应该是块吧 
      

  3.   

    SQL> desc dba_extents
    Name            Type         Nullable Default Comments                                                  
    --------------- ------------ -------- ------- --------------------------------------------------------- 
    OWNER           VARCHAR2(30) Y                Owner of the segment associated with the extent           
    SEGMENT_NAME    VARCHAR2(81) Y                Name of the segment associated with the extent            
    PARTITION_NAME  VARCHAR2(30) Y                Partition/Subpartition Name, if any, of the segment       
    SEGMENT_TYPE    VARCHAR2(18) Y                Type of the segment                                       
    TABLESPACE_NAME VARCHAR2(30) Y                Name of the tablespace containing the extent              
    EXTENT_ID       NUMBER       Y                Extent number in the segment                              
    FILE_ID         NUMBER       Y                Name of the file containing the extent                    
    BLOCK_ID        NUMBER       Y                Starting block number of the extent                       
    BYTES           NUMBER       Y                Size of the extent in bytes                               
    BLOCKS          NUMBER       Y                Size of the extent in ORACLE blocks                       
    RELATIVE_FNO    NUMBER       Y                Relative number of the file containing the segment header 
     
    SQL>