Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to get user tablespace information?
so user_tablespaces isn't what you are after?
How about something like this:
set pagesize 999 feedback off verify on linesize 600
column tablespace_name heading 'Tablespace' format a20
column object_count heading 'Objects|(#)' format 999990
column mb heading 'Mb' format 9990
column sum(frags) heading 'Frags|(#)' format 9999
column avail heading 'Max|(Mb)' format 9999.99
column free heading 'Free|(%)' format 999.9
column bytesize heading 'Size|(Mb)' format 99999 column byteused heading 'Used|(Mb)' format 99990 column bytefree heading 'Free|(Mb)' format 9999 column init_ext heading 'Initial|(K)' format 999999999 column next_ext heading 'Next|(K)' format 999999
spool tablespace_statistics.sql
select tablespace_name, sum(obj_cnt) object_count, sum(ini_ext)
init_ext, sum(nex_ext) next_ext, sum(byte)/1048576 bytesize,
round((sum(byte)/1048576)- (sum(fbyte)/1048576),2) byteused, round(sum(fbyte)/1048576,2) bytefree, sum(frags) "Frags", round(sum(largest)/1048576,2) avail, round((sum(fbyte)/sum(byte))*100,2) freefrom
or, for the high water mark (courtesy of Tim Hall):
/*
-- File Name hw_mark.sql
Dbms_Space.Unused_Space(cur_rec.owner,cur_rec.table_name,'TABLE',op1,op2,op3,op4,op5,op6,op7);
Dbms_Output.Put_Line(RPad(cur_rec.table_name,30,' ') || LPad(op3,15,' ') || LPad(op1,15,' ') || LPad(Trunc(op1-op3-1),15,' '));END LOOP;