The following script lists out the top segments in your database by size grouping by segment type.
COLUMN segment_type FORMAT A20 HEADING 'Segment_Type'
COLUMN owner FORMAT A15 HEADING 'Owner'
COLUMN segment_name FORMAT A30 HEADING 'Segment_Name'
COLUMN partition_name FORMAT A30 HEADING 'Partition_Name'
COLUMN tablespace_name FORMAT A20 HEADING 'Tablespace_Name'
COLUMN bytes FORMAT 9,999,999,999,999 HEADING 'Size (in bytes)'
COLUMN extents FORMAT 999,999,999 HEADING 'Extents'
BREAK ON segment_type SKIP 1
COMPUTE sum OF bytes ON segment_type
SELECT
a.segment_type segment_type
, a.owner owner
, a.segment_name segment_name
, a.partition_name partition_name
, a.tablespace_name tablespace_name
, a.bytes bytes
, a.extents extents
FROM
(select
b.segment_type
, b.owner
, b.segment_name
, b.partition_name
, b.tablespace_name
, b.bytes
, b.extents
from
dba_segments b
order by
b.bytes desc
) a
WHERE
rownum < 101
ORDER BY
segment_type, bytes desc, owner, segment_name
/
COLUMN segment_type FORMAT A20 HEADING 'Segment_Type'
COLUMN owner FORMAT A15 HEADING 'Owner'
COLUMN segment_name FORMAT A30 HEADING 'Segment_Name'
COLUMN partition_name FORMAT A30 HEADING 'Partition_Name'
COLUMN tablespace_name FORMAT A20 HEADING 'Tablespace_Name'
COLUMN bytes FORMAT 9,999,999,999,999 HEADING 'Size (in bytes)'
COLUMN extents FORMAT 999,999,999 HEADING 'Extents'
BREAK ON segment_type SKIP 1
COMPUTE sum OF bytes ON segment_type
SELECT
a.segment_type segment_type
, a.owner owner
, a.segment_name segment_name
, a.partition_name partition_name
, a.tablespace_name tablespace_name
, a.bytes bytes
, a.extents extents
FROM
(select
b.segment_type
, b.owner
, b.segment_name
, b.partition_name
, b.tablespace_name
, b.bytes
, b.extents
from
dba_segments b
order by
b.bytes desc
) a
WHERE
rownum < 101
ORDER BY
segment_type, bytes desc, owner, segment_name
/
Segment_Type Owner Segment_Name Partition_Name Tablespace_Name Bytes Extents
----------------- -------- --------------------- ---------------------- ------------------------- -------- ----------
INDEX xxx xxxxxxxx xxxxxxxx xxxxxxxx xxxx xxxxx
LOB PARTITION xxx xxxxxxxx xxxxxxxx xxxxxxxx xxxx xxxxx
LOBSEGMENT xxx xxxxxxxx xxxxxxxx xxxxxxxx xxxx xxxxx
TABLE xxx xxxxxxxx xxxxxxxx xxxxxxxx xxxx xxxxx
TABLE PARTITION xxx xxxxxxxx xxxxxxxx xxxxxxxx xxxx xxxxx
----------------- -------- --------------------- ---------------------- ------------------------- -------- ----------
INDEX xxx xxxxxxxx xxxxxxxx xxxxxxxx xxxx xxxxx
LOB PARTITION xxx xxxxxxxx xxxxxxxx xxxxxxxx xxxx xxxxx
LOBSEGMENT xxx xxxxxxxx xxxxxxxx xxxxxxxx xxxx xxxxx
TABLE xxx xxxxxxxx xxxxxxxx xxxxxxxx xxxx xxxxx
TABLE PARTITION xxx xxxxxxxx xxxxxxxx xxxxxxxx xxxx xxxxx
No comments:
Post a Comment