database 在 Oracle 中查找数据库的大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4301672/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 07:56:16  来源:igfitidea点击:

Find Size of a Database in Oracle

databaseoracle

提问by Kanini

I have a database named "My_Enterprise_Data". I need to find the size that it occupies on the disk.

我有一个名为“My_Enterprise_Data”的数据库。我需要找到它在磁盘上占用的大小。

How do I find it out?

我如何找到它?

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

SELECT sum(bytes)/1024/1024 AS "Size in MB" FROM user_segments针对 My_Enterprise_Data 运行的查询是否正确?

回答by Neal Donnan

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

下面将向您展示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

然后,您可以查找 My_Enterprise_Data 架构使用的表空间

回答by Ashrumochan Senapati

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.

oracle 数据库由数据文件、重做日志文件、控制文件、临时文件组成。数据库的大小实际上意味着所有这些文件的总大小。

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

回答by Thakkar Amit

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;

回答by dbaadmin

there is two ways to calculate the Database size in Oracle,

Oracle有两种计算数据库大小的方法,

one is from os side and another is by login to datbase,

一个来自操作系统端,另一个是登录数据库,

You also can see here the details procedure for both ways

您还可以在此处查看两种方式的详细程序

回答by santosh tiwary

Great... dba_segments gives the Oracle database size

太好了... dba_segments 给出了 Oracle数据库的大小

To find the actual space occupied by the database.

查找数据库实际占用的空间。

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

从 dba_segments 中选择 sum(bytes)/1024/1024/1024;