Thursday, December 9, 2010

Calculate the total size of 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.

sql>define_editor=ed
sql>select ROUND( ( a.data_size + b.temp_size +
c.redo_size + d.cf_size +
e.bct_size)
/1024/1024/1024
) "total_GB_size"
from
( 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


sql>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

 The following command calculates the Harddisk space of linux i.e., its overall size. You will need root privilege to run this script.

#fdisk -l | grep Disk

#vi /proc/cpuinfo

# free -m

1 comment:

  1. The give program is to calculate the total size of the Oracle database. The program is short and simple. It will not take too much time to understand the given coding. I think this is the simplest way to calculate the total size of the database.

    ReplyDelete