Translate into your own language

Sunday, March 13, 2016

To determine total space, used space, free space and percentage of used and free space in all the tablespaces in oracle

To determine total space, used space, free space and percentage of used and free space in all the tablespaces in oracle:


If yo want to determine tolat space, used space, free space and percentage of used and free space in all the tablespaces in a database user below query:

SQL> SET LINESIZE 100
SQL> COLUMN TABLESPACE FORMAT A15

SQL>select t.tablespace, t.totalspace as " Totalspace(MB)", round((t.totalspace-fs.freespace),2) as "Used Space(MB)", fs.freespace
as "Freespace(MB)", round(((t.totalspace-fs.freespace)/t.totalspace)*100,2) as "% Used", round((fs.freespace/t.totalspace)*100,2)
as "% Free" from (select round(sum(d.bytes)/(1024*1024)) as totalspace, d.tablespace_name tablespace from dba_data_files d group
by d.tablespace_name) t, (select round(sum(f.bytes)/(1024*1024)) as freespace, f.tablespace_name tablespace from dba_free_space f
group by f.tablespace_name) fs where t.tablespace=fs.tablespace order by t.tablespace;


TABLESPACE   Totalspace(MB)     Used Space(MB)    Freespace(MB)     % Used     % Free
---------------        --------------------------     ----------------------   --------------------  ------------   -----------
LAGOBLO            4096                      1                              4095                    .02           99.98
LAGODAT            173052                  167101                    5951                96.56             3.44
LAGOHIST           4324                      4087                        237                   94.52            5.48
LAGOIDX             223204                  202645                    20559               90.79            9.21
LAGOTHN            4096                      1                              4095                     .02          99.98
SYSAUX               7850                      1643                        6207                 20.93          79.07
SYSTEM               1660                      1654                        6                        99.64              .36
UNDOTBS1          5690                      463                          5227                    8.14          91.86
USERS                   5                           2                              3                        40               60

No comments:

Post a Comment