开发者

Find Size of a Database in Oracle

I have a database named "My_Enterprise_Data". I need to find the size that it开发者_开发问答 occupies on the disk.

How do I find it out?

Is the query, SELECT sum(bytes)/1024/1024 AS "Size in MB" FROM user_segments run against the My_Enterprise_Data correct?


The following will show you the data files used by oracle:

select TABLESPACE_NAME "Tablspace",  
 FILE_NAME "Filename",  
 BYTES/1024/1024 "Size MB", 
 MAXBYTES/1024/1024 "Maximum Size MB", 
 AUTOEXTENSIBLE "Autoextensible"
from SYS.DBA_DATA_FILES

You can then look for the tablespace used by the My_Enterprise_Data schema


An oracle database consists of data files, redo log files, control files, temporary files. The size of the database actually means the total size of all these files.

select 
( select sum(bytes)/1024/1024/1024 data_size from dba_data_files ) +
( select nvl(sum(bytes),0)/1024/1024/1024 temp_size from dba_temp_files ) +
( select sum(bytes)/1024/1024/1024 redo_size from sys.v_$log ) +
( select sum(BLOCK_SIZE*FILE_SIZE_BLKS)/1024/1024/1024 controlfile_size from v$controlfile) "Size in GB"
from
dual


SELECT a.data_size + b.temp_size + c.redo_size + d.controlfile_size 
"total_size in GB" 
FROM (SELECT SUM (bytes) / 1024 / 1024/1024 data_size FROM dba_data_files) a, 
(SELECT NVL (SUM (bytes), 0) / 1024 / 1024/1024 temp_size 
FROM dba_temp_files) b, 
(SELECT SUM (bytes) / 1024 / 1024/1024 redo_size FROM sys.v_$log) c, 
(SELECT SUM (BLOCK_SIZE * FILE_SIZE_BLKS) / 1024 / 1024/1024 
controlfile_size 
FROM v$controlfile) d;


Great... dba_segments gives the Oracle database size

To find the actual space occupied by the database.

Select sum(bytes)/1024/1024/1024 from dba_segments;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜