REM REM DBAToolZ NOTE: REM This script was obtained from DBAToolZ.com REM It's configured to work with SQL Directory (SQLDIR). REM SQLDIR is a utility that allows easy organization and REM execution of SQL*Plus scripts using user-friendly menu. REM Visit DBAToolZ.com for more details and free SQL scripts. REM REM REM File: REM s_db_segs2.sql REM REM MOST TABSP STORAGE REM REM Author: REM Vitaliy Mogilevskiy REM VMOGILEV REM (www.dbatoolz.com) REM REM Purpose: REM REM USE s_db_segs3.sql for a detailed report of segments REM REM Reports SUM(bytes) for all segments by owner groupping them by REM the current size from dba_segments. REM REM There is a theory by which you only need 3 types REM of tablespaces: REM 160k (SMALL) REM 5MBm (MEDIUM) REM 160MB (LARGE) REM If you follow this theory you can use this script REM to "place" your segments in the "right" tablespace: REM 1. 160K ts (segs < 5MB) REM 2. 5MB ts (segs < 160MB) REM 3. 160MB ts (segs > 160MB) REM REM REM Usage: REM s_db_segs2.sql REM REM Example: REM s_db_segs2.sql SCOTT REM REM History: REM 08-01-2001 VMOGILEV Created REM accept 1 prompt "Enter owner for the segments: " accept 2 prompt "Enter segment type (like)[ TABLE% or INDEX% ]: " spool segs_sum.&&1..&&2..log set verify off col mbs format 999,999.00 heading "MBytes" break on report compute sum of mbs on report select '160K ts (segs < 5MB)' descr , sum(bytes)/1024/1024 mbs , segment_type from dba_segments where owner='&&1' and segment_type like '&&2' and bytes < 5*1024*1024 group by segment_type union all select '5MB ts (segs < 160MB)' descr , sum(bytes)/1024/1024 mbs , segment_type from dba_segments where owner='&&1' and segment_type like '&&2' and (bytes < 160*1024*1024 and bytes >= 5*1024*1024) group by segment_type union all select '160MB ts (segs > 160MB)' descr , sum(bytes)/1024/1024 mbs , segment_type from dba_segments where owner='&&1' and segment_type like '&&2' and bytes >= 160*1024*1024 group by segment_type / clear breaks select to_char(sum(bytes)/1024/1024,'999,999.00') mbs from dba_segments where owner='&&1' and segment_type like '&&2' / spool off