set lines 120 pages 500
col owner format a30
col segment_name format a30
col tab_sum format 999999999999999
col indx_sum format 999999999999999
col MB format 999999999
accept pvm_owner prompt ‘Enter Owner Name -> ‘
accept pvm_table prompt ‘Enter Table Name -> ‘
select tab.owner, tab.segment_name, tab.tablespace_name, (tab_sum+indx_sum)/(1024*1024) MB from
(select p.owner, p.segment_name, p.tablespace_name, sum(p.bytes) tab_sum
from dba_segments p
where p.segment_type = ‘TABLE’
group by p.owner, p.segment_name, p.tablespace_name) tab,
(select b.owner, b.table_name, sum(a.bytes) indx_sum
from dba_segments a, dba_indexes b
where a.SEGMENT_NAME = b.index_name
and a.segment_type = ‘INDEX’
and a.owner = b.owner
group by b.owner, b.table_name) indx
where tab.owner = indx.owner
and tab.segment_name = indx.table_name
and tab.owner = upper(‘&pvm_owner’)
and tab.segment_name = upper(‘&pvm_table’)
order by 1, 2;