Monday, September 27, 2010

How to calculate the size of Oracle Database

What script do I run to get the size of an Oracle Database?

The following script calculates the storage allocated to an Oracle database, i.e., its overall size. You will need DBA privilege to run this script.

select ROUND( ( a.data_size + b.temp_size +
c.redo_size + d.cf_size +
) "total_GB_size"
( select SUM(bytes) data_size from v$datafile) a,
( select NVL(sum(bytes),0) temp_size from v$tempfile) b,
( select SUM(bytes) redo_size from v$log) c,
( select SUM(block_size*file_size_blks) cf_size from v$controlfile) d,
( select NVL(bytes,0) bct_size from v$block_change_tracking) e

select a.data_size+b.temp_size+c.redo_size "total_size"
from ( select sum(bytes)/1024/1024 data_size
from dba_data_files )a,
( select nvl(sum(bytes),0)/1024/1024 temp_size
from dba_temp_files ) b,
( select sum(bytes)/1024/1024 redo_size
from sys.v_$log ) c

No comments: