Sunday, August 16, 2015

Oracle : Script will report tablespace use by segment type and user

ttitle - center  'Space Usage per Segment Type per Tablespace per User'  skip 2

 col username        formata20 justify c heading 'Username'
 col tablespace_name format            a20 justify c heading 'Tablespace Name'
 col segment_type    format            a17 justify c heading 'Segment Type'
 col mbytes          format 999,999,990.99 justify c heading 'Mb Used'
 
 break -
   on username skip 1
 
 select
   owner                  username,
   segment_type           segment_type,
   sum(bytes)/1048576     mbytes,
   tablespace_name        tablespace_name
 from
   dba_segments
 group by
   owner,
   tablespace_name,
   segment_type
 order by
   owner,
   segment_type,
   tablespace_name

No comments:

Post a Comment