Thursday, April 7, 2011

How to get the size of an Oracle database

If you need to get the size of an Oracle database (excluding software, logs and things like that), you can do that this way:

SQL> select 'ONLINE_REDOLOG' as TYPE, sum(BYTES*MEMBERS)/1048576 as SIZE_MB from v$log union
select 'DATAFILES', sum(BYTES)/1048576 from v$datafile union
select 'TEMPFILES', sum(BYTES)/1048576 from v$tempfile union
select 'CONTROLFILES', sum(BLOCK_SIZE*FILE_SIZE_BLKS)/1048576 from v$controlfile union
select 'FLASH_RECOVERY_AREA', VALUE/1048576 from v$parameter where NAME='db_recovery_file_dest_size';

TYPE SIZE_MB
------------------- ----------
CONTROLFILES 14.1875
DATAFILES 1230
FLASH_RECOVERY_AREA 3072
ONLINE_REDOLOG 300
TEMPFILES 25

No comments:

Post a Comment