Oracle Tablespaces information



column FileNum        format 999        heading 'File|Num'
column FileName     format A60      heading 'File Name'
column Tablespace   format A30      heading 'Tblspace'
column Allocated    format 9,999    heading 'Size|(MB)'
column div1         format A3       heading ' | '
column Used         format 9,999    heading 'Used|(MB)'
column Pct_Used     format 999.99   heading 'Used|(%)'
column div2         format A3       heading ' | '
column TotalFree    format 9,999    heading 'Free|(MB)'
column Pct_Free     format 999.99   heading 'Free|(%)'
column MaxFree      format 9,999    heading 'MaxFree'
column status       format A3       heading 'STA'

column oneMB noprint new_value MB

compute sum of Allocated on tablespace
compute sum of Allocated on report
compute sum of Used      on tablespace
compute sum of Used      on report
compute sum of TotalFree on tablespace
compute sum of TotalFree on report

select substr(to_char(x.file_id,999), 1,4)     FileNum,
       x.file_name                             FileName,
       x.tablespace_name                       Tablespace,
       x.bytes/(1024*1024)                     Allocated,
       (x.bytes-sum(y.bytes))/(1024*1024)      Used,
        substr(x.status,1,3)                    status
from sys.dba_data_files x ,
     sys.dba_free_space  y
where x.file_id = y.file_id
group by substr(to_char(x.file_id,999), 1,4),
         x.file_name,
         x.tablespace_name,
         x.bytes,
         x.status 
order by 1,2,3;

Post a Comment

And that's all there is to it!

If anyone has any other questions or requests for future How To posts, you can either ask them in the comments or email me. Please don't feel shy at all!

I'm certainly not an expert, but I'll try my hardest to explain what I do know and research what I don't know.

Previous Post Next Post