Latest posts by Cyrille Modiano (see all)
- Renaming a RAC cluster - 27/09/2018
- Stop/Start all RAC databases at once - 26/09/2018
- RMAN Backup script - 08/11/2017
Calculate the space used by a single object
This script will help you calculate the size of a single object :
SELECT s.owner, s.segment_name, s.bytes/1024/1024 "Size(MB)" FROM dba_segments s, dba_lobs l WHERE s.owner = '&schema_name' AND s.owner=l.owner(+) AND s.segment_name = CASE WHEN s.segment_type = 'LOBSEGMENT' THEN L.SEGMENT_NAME(+) WHEN s.segment_type = 'LOBINDEX' THEN L.INDEX_NAME(+) END AND s.SEGMENT_NAME='&segment_name';
Calculate the space used by a whole schema
If you want the space used by a whole schema, then here is a variation of the first query :
SELECT s.owner, SUM(s.bytes/1024/1024) "Size(MB)" FROM dba_segments s, dba_lobs l WHERE s.owner = '&schema_name' AND s.owner=l.owner(+) AND s.segment_name = CASE WHEN s.segment_type = 'LOBSEGMENT' THEN L.SEGMENT_NAME(+) WHEN s.segment_type = 'LOBINDEX' THEN L.INDEX_NAME(+) END group by s.owner order by 2;