Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Help coalescing free space
Here is a script I got from Oracle Support (note the disclaimer though),
and it
proved to be very beneficial to me.
REM SET ECHO ON
REM NAME: TFSCOAL.SQL
REM USAGE:"@path/exec tfscoal"
REM
REM Tablespace 2 -- coalesced 1 extents. REM Tablespace 5 -- coalesced 59 extents. REM Tablespace 5 -- coalesced 59 extents. REM Tablespace 6 -- coalesced 21 extents.REM
set serveroutput on
DECLARE
tsid number;
tsname varchar(30);
cnt number; lev number; dummy integer; cur integer;
cursor contig is
select c.ts#, c.name, count(*) from sys.fet$ a, sys.fet$ b, sys.ts$ c where a.ts# = b.ts# and a.ts# = c.ts# /* and c.name not in ('TEMP' , 'DWDIFF', 'RBS') */ and a.file# = b.file# and (a.block#+a.length) = b.block# group by c.ts#,c.name;
fetch contig into tsid, tsname, cnt; exit when contig%NOTFOUND; nothing:= FALSE; lev := power(2,16)*cnt + tsid; if (lev < 0) or (lev > 4294967296) then raise INVALID_NUMBER; end if; cur:= dbms_sql.open_cursor; dbms_sql.parse(cur, 'alter session set events ''immediate trace name coalesce level '||lev||' ''',dbms_sql.v7);
dummy:= dbms_sql.execute(cur); dbms_sql.close_cursor(cur); dbms_output.put_line('Tablespace '||tsname||' ('||tsid|| ') -- coalesced '||cnt||' extents.');end loop;
dbms_output.put_line('Nothing to coalesce!');
end if;
end;
/
Nadira Received on Mon Oct 27 1997 - 00:00:00 CST