Thursday, September 27, 2012

ORACLE APPS DBA QUERY

                                                      Query to find Database Size
SELECT sum(bytes)/1024/1024 data_size FROM dba_data_files;


Query to get the size of all TEMP files:

SELECT nvl(sum(bytes),0)/1024/1024 temp_size FROM dba_temp_files;

Query to find space used by a database user.
SELECT sum(bytes)/1024/1024 user_size FROM user_segments;

Query to find the space occupied by all the users in a database.
SELECT owner, sum(bytes)/1024/1024 total_size FROM dba_segments
GROUP BY owner ORDER BY total_size DESC;

Total space occupied by all users:
SELECT sum(bytes)/1024/1024 total_size FROM dba_segments; 

Query to find free space in temporary tablesapce:
SELECT tablespace_name,SUM(bytes_used),SUM(bytes_free) FROM 
V$temp_space_header GROUP BY tablespace_name; 

Script to find Table size in a database.
select sum(BYTES/1024/1024) as TOTAL_GIG from user_segments where
SEGMENT_NAME = 'TABLE_NAME';

No comments:

Post a Comment