DJ메탈짱™의 Free Style

[ORACLE] DataBase Size & Table Size 구하기 #SUM() 본문

일(job)/DBMS

[ORACLE] DataBase Size & Table Size 구하기 #SUM()

뽀&쏭 2016. 1. 18. 16:14



1. DataBase Size

SELECT SUM(bytes)/1024/1024 
FROM dba_data_files;

 

2. Table Size
SELECT SUM(bytes)/1024/1024
FROM dba_extents
WHERE segment_name='CORP_NEWS_TB';

 

3.

=================================================================

The biggest portion of a database"s size comes FROM the datafiles. 
To find out how many megabytes are allocated to ALL datafiles:

 

--> SELECT SUM(bytes)/1024/1024 "Meg" 
      FROM dba_data_files;

 

To get the size of all TEMP files:

--> SELECT nvl(SUM(bytes),0)/1024/1024 "Meg" 
      FROM dba_temp_files;

 

To get the size of the on-line redo-logs:

--> SELECT SUM(bytes)/1024/1024 "Meg" 
      FROM sys.v_$log;

 

Putting it all together into a single query:

=================================================================
SELECT a.data_size + b.temp_size + c.redo_size "total_size"
FROM 

   SELECT SUM(bytes) data_size
   FROM dba_data_files 
) a,

   SELECT NVL(SUM(bytes),0) temp_size
   FROM dba_temp_files 
) b,

   SELECT SUM(bytes) redo_size
   FROM sys.v_$log 
) c
/

=================================================================


3번 영문자료 출처 : http://orafaq.com