DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Find no of extents allocated for a TS

  1. #1
    Join Date
    Oct 2004
    Location
    Chennai
    Posts
    13

    Find no of extents allocated for a TS

    1)What is the query to find the no of extents allocated to a
    tablespace.
    2) Also how do i find the no of bytes used in the datafile
    3)what does USER_BYTES col in DBA_DATA_FILES imply

    Just a baby in oracle and so please enlighten my ignorance
    Last edited by svij21; 11-18-2004 at 12:49 AM.
    Thanx
    Vijay

  2. #2
    Join Date
    Sep 2003
    Location
    over the hill and through the woods
    Posts
    995
    Here this will solve questions 1 & 2.

    Code:
    Select t.tablespace_name  "Tablespace",
     t.status "Status",  
     ROUND((MAX(d.bytes)/1024/1024) - (SUM(decode(f.bytes, NULL,0, f.bytes))/1024/1024),2) "Used MB", 
     ROUND(SUM(decode(f.bytes, NULL,0, f.bytes))/1024/1024,2) "Free MB" , 
     t.initial_extent "Initial Extent",   
     t.next_extent "Next Extent",  
     t.min_extents "Min Extents", 
     t.max_extents "Max Extents", 
     t.pct_increase "Pct Increase" 
     , SUBSTR(d.file_name,1,80) "Datafile name" 
    FROM DBA_FREE_SPACE f , DBA_DATA_FILES d , DBA_TABLESPACES t 
    WHERE t.tablespace_name = d.tablespace_name  
     AND f.tablespace_name(+) = d.tablespace_name  
     AND f.file_id(+) = d.file_id
    GROUP BY t.tablespace_name , 
     d.file_name , 
     t.initial_extent ,  
     t.next_extent , 
     t.min_extents , 
     t.max_extents ,  
     t.pct_increase , t.status   
     ORDER BY 1,3 DESC
    question 3 you're on your own. I can't answer all of everyones questions, I have a reputation to live up to
    Oracle it's not just a database it's a lifestyle!
    --------------
    BTW....You need to get a girlfriend who's last name isn't .jpg

  3. #3
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    The bytes in dba_data_files shows total allocated bytes for a data file.
    The user_bytes col shows the total available bytes to be used by segments.

    Oracle stores the header info at the beginning of the data file. It uses 8K for DMT, 64K for LMT defined with auto allocate, 1MB for LMT defined with UNIFORM EXTENT size of more than the default value.

    The formula is:
    Data file header info size = (bytes - user_bytes).

    Tamil

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width