password2.svg-rect9367-4294966516

The script below comes handy for a database developer/dba to find out the total tablespace utilized in GB for a given schema:

Tablespace utilization in GB for a given owner

SELECT tablespace_name,
sum(bytes)/1024/1024/1024 AS total_size_gb
FROM dba_segments
WHERE owner = '<OWNER>'
GROUP BY owner, rollup(tablespace_name);

Example – Below is the example to find the total tablespace untilization for user – SCOTT:

SELECT tablespace_name,
sum(bytes)/1024/1024/1024 AS total_size_gb
FROM dba_segments
WHERE owner = 'SCOTT'
GROUP BY owner, rollup(tablespace_name);