Friday, April 5, 2019

How do I find the size of a schema in my oracle database 12.2 ?

How do I find the size of a schema in my oracle database 12.2 ?

Solution: 

It depends on how you define "size".  If you want the total disk space consumed by the schema (including indexes, tablespace free space), then the SQL query is quite simple:

select owner,sum(bytes)/1024/1024/1024 schema_size_gig from dba_segments  group by owner;
OWNER                          SCHEMA_SIZE_GIG
------------------------------ ---------------
TEST                                .252441406
MENT                                .001831055
TTTT                                .000305176
NEW_SCHEMA                          .017822266
TEST1                               25.3795166
FRP_TT                               .00012207


If you just want the size of the schema in terms of the space consumed by table rows, you would use a different query to calculate the schema size:

select sum(bytes)/1024/1024/1024 as size_in_gig,segment_type from dba_segments where owner='TEST1' group by segment_type;

OWNER                          SCHEMA_SIZE_GIG
------------------------------ ---------------
TEST1                               25.3795166

No comments:

Post a Comment

How can I restore Cassandra snapshots?