Find the larger size Table / Index in Oracle

Check the top big-size table/index/segment in Oracle

Check the larger segment in Oracle

The following query will return the top 10 largest tables in the Oracle database

SET LINESIZE 200
COLUMN owner FORMAT A10
COLUMN segment_name FORMAT A30
COLUMN tablespace_name FORMAT A15
COLUMN size_mb FORMAT 99999.00

SELECT *
FROM   (SELECT owner,
               segment_name,
               segment_type,
               tablespace_name,
               ROUND(bytes/1024/1024,2) size_mb
        FROM   dba_segments where owner not in ('SYS','SYSTEM') and segment_type = 'TABLE'
        ORDER BY 5 DESC)
WHERE  ROWNUM <= 10;

Check the top size indexes in the Oracle Database

SET LINESIZE 200
COLUMN owner FORMAT A10
COLUMN segment_name FORMAT A30
COLUMN tablespace_name FORMAT A15
COLUMN size_mb FORMAT 99999.00

SELECT *
FROM   (SELECT owner,
               segment_name,
               segment_type,
               tablespace_name,
               ROUND(bytes/1024/1024,2) size_mb
        FROM   dba_segments where owner not in ('SYS','SYSTEM') and segment_type = 'INDEX'
        ORDER BY 5 DESC)
WHERE  ROWNUM <= 10;

Check the top 10 object consuming most of the space in Oracle Database

SET LINESIZE 200
COLUMN owner FORMAT A10
COLUMN segment_name FORMAT A30
COLUMN tablespace_name FORMAT A15
COLUMN size_mb FORMAT 99999.00

SELECT *
FROM   (SELECT owner,
               segment_name,
               segment_type,
               tablespace_name,
               ROUND(bytes/1024/1024,2) size_mb
        FROM   dba_segments where owner not in ('SYS','SYSTEM')
        ORDER BY 5 DESC)
WHERE  ROWNUM <= 20;

This entry was posted in Oracle on by .
Unknown's avatar

About SandeepSingh

Hi, I am working in IT industry with having more than 15 year of experience, worked as an Oracle DBA with a Company and handling different databases like Oracle, SQL Server , DB2 etc Worked as a Development and Database Administrator.

Leave a Reply