-- -----------------------------------------------------------------------------------
-- File Name    : segments_in_ts.sql
-- Author       : DBA Learning Hub
-- Description  : Lists the objects stored in a tablespace.
-- Call Syntax  : @objects_in_ts (tablespace-name)
-- Last Modified: 15/07/2025
-- -----------------------------------------------------------------------------------

SET PAGESIZE 20
BREAK ON segment_type SKIP 1

COLUMN segment_name FORMAT A30
COLUMN partition_name FORMAT A30

SELECT segment_type,
       segment_name,
       partition_name,
       ROUND(bytes/2014/1024,2) AS size_mb
FROM   dba_segments
WHERE  tablespace_name = UPPER('&1')
ORDER BY 1, 2;

CLEAR BREAKS
