Translate into your own language

Friday, March 11, 2016

How to find the database size in Oracle

How to find the database size in Oracle:

There are four major components that consume disk space and actually define the total physical size of any oracle database: (1) Data Files; (2) Temporary Files; (3) Online Log Files; and (4) Archived Log Files(that have not been backed up yet, and therefore are still left on the disk). So, if we calculate the sum of all these four components, the result should tell us the total physical size of your database:

SQL>select sum(siz1) "TOTAL_DB_SIZE(GB)" from
         (
         (select round(sum(bytes/(1024*1024*1024))) siz1 from dba_data_files)
         union all
         (select round(sum(bytes/(1024*1024*1024))) siz1 from dba_temp_files)
         union all
         (select round(sum(bytes/(1024*1024*1024))) siz1 from v$log)
         union all
        (select round(sum(blocks*block_size/(1024*1024*1024))) siz1 from v$archived_log
        where name is not null)
         );


Output:

TOTAL_DB_SIZE(GB)
------------------------------
              429

1 comment: