Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Find out the top 20 biggest tables
Ralf Bender wrote:
> Ralf Bender said the following on 18.03.2005 08:44:
>
>> Hi >> >> has anyone a script to find out the top 20 biggest tables in a >> tablespace? >> >> regards >> ralf
The previously posted answers are a start, but to be thorough you need to also include LOB segments and table partitions, which may not all be in the same tablespace. Here is an example to find all the storage associated with a single table, including index storage (the "top 20" aspect is not included here):
col segment_name format a20
col partition_name format a20
col tablespace_name format a20
select
ds.segment_name, ds.segment_type, ds.partition_name, ds.tablespace_name, ds.bytes, ds.blocks, ds.extents from dba_segments ds, dba_indexes di where di.table_name = '&&table' and di.owner = '&&owner'
ds.segment_name, ds.segment_type, ds.partition_name, ds.tablespace_name, ds.bytes, ds.blocks, ds.extents from dba_segments ds, dba_tables di where di.table_name = '&&table' and di.owner = '&&owner'
ds.segment_name, ds.segment_type, ds.partition_name, ds.tablespace_name, ds.bytes, ds.blocks, ds.extents from dba_segments ds, dba_lobs di where di.table_name = '&&table' and di.owner = '&&owner'
-Mark Bole Received on Fri Mar 18 2005 - 09:46:11 CST