Query to find Table size

By Amol Jadhav

Query to find Table size
Oracle apps EBS table size

SQL Querysql
1SELECT owner, table_name, TRUNC (SUM (bytes) / 1024 / 1024) MB
2    FROM (SELECT segment_name table_name, owner, bytes
3            FROM dba_segments
4           WHERE segment_type IN ('TABLE', 'TABLE PARTITION')
5          UNION ALL
6          SELECT i.table_name, i.owner, s.bytes
7            FROM dba_indexes i, dba_segments s
8           WHERE     s.segment_name = i.index_name
9                 AND s.owner = i.owner
10                 AND s.segment_type IN ('INDEX', 'INDEX PARTITION')
11          UNION ALL
12          SELECT l.table_name, l.owner, s.bytes
13            FROM dba_lobs l, dba_segments s
14           WHERE     s.segment_name = l.segment_name
15                 AND s.owner = l.owner
16                 AND s.segment_type IN ('LOBSEGMENT', 'LOB PARTITION')
17          UNION ALL
18          SELECT l.table_name, l.owner, s.bytes
19            FROM dba_lobs l, dba_segments s
20           WHERE     s.segment_name = l.index_name
21                 AND s.owner = l.owner
22                 AND s.segment_type = 'LOBINDEX')
23   WHERE owner IN UPPER ('ONT')                              --Table Owner Name
24                              AND table_name = 'OE_ORDER_LINES_ALL' --Table Name
25GROUP BY table_name, owner

Related posts: