oracle schema size 1

oracle schema size

SELECT sum(BYTES) / 1e6 AS SIZE_MB FROM DBA_SEGMENTS WHERE OWNER = 'schema_name';
-- By type
SELECT SEGMENT_TYPE, sum(BYTES) / 1e6 AS SIZE_MB FROM DBA_SEGMENTS
    WHERE OWNER = 'schema_name' GROUP BY SEGMENT_TYPE;
-- By schema
SELECT OWNER, sum(BYTES) / 1e6 AS SIZE_MB FROM DBA_SEGMENTS GROUP BY OWNER
    ORDER BY SIZE_MB DESC;

Here is what the above code is Doing:
1. The first query is getting the total size of the schema in MB.
2. The second query is getting the size of the schema by segment type.
3. The third query is getting the size of all schemas in the database.

The output of the above code is:

“`
SIZE_MB
———-
5.8125

SEGMENT_TYPE

Similar Posts