Sunday, October 7, 2018

How to list all schemas and their sizes


If you want a list of schema sizes, join dba_segments with dba_users to limit the extract to users that are non-oracle maintained:
set lines 200
col owner  format a30
col "GB" format 999999
SELECT s.owner,sum(s.bytes/1024/1024/1024) "GB"
FROM dba_segments s join dba_users u
on (s.owner = u.username)
where u.oracle_maintained = 'N'
group by owner
ORDER BY 2 desc;

Example output
OWNER                               GB
------------------------------ -------
USER1                            19577
USER2                             6144
USER3                             2306

No comments:

Post a Comment