OraPub System Monitor (OSM) Toolkit
Get Complete OSM Toolkit (free)

ashclp.sql
ashclpct.sql
ashp.sql
ashpctcpu.sql
ashpcte.sql
ashpctecl.sql
ashpctes.sql
ashpcts.sql
ashrt.sql
ashrt_old.sql
ashsp.sql
ashspct.sql
ashsqlcl.sql
ashsqle.sql
ashsqlpctcl.sql
ashsqlpctcpu.sql
ashsqlpcte.sql
ashsqlpcts.sql
ashsqlpctt.sql
ashsqls.sql
avgexplore.sql
bc.sql
bc7.sql
bcmap.sql
bcmap7.sql
bcobjfb.sql
chr.sql
clone.sql
cr_rtsp.sql
cu.sql
cycledb6
cycledb9
dboc.sql
delete.me
dev_list.txt
dfio.sql
dfl.sql
diag.sql
ds.sql
ds7.sql
dsn.sql
eval1.sql
event_type.sql
event_type_nc.sql
fgidx.sql
fgtbl.sql
hashchk.sql
idx.sql
iosum.sql
iosum9.sql
iosum9x.sql
iosumx.sql
ip.sql
ipcbc.sql
ipx.sql
irtviews.sql
istat.sql
latch.sql
latch8.sql
latch_old.sql
latchchild.sql
latchclass.sql
latchx.sql
lc.sql
lock.sql
loghist8.sql
lruno.sql
mkodo.sql
mkodo_ouch.sql
mts.sql
mysess.sql
objfb.sql
objloc.sql
ogbigld.sql
ogcrobj.sql
ogdoit.sql
ogobjlst.sql
ogobjset.sql
oracpu.sql
oracputext.sql
oracpux.sql
oracpux1.sql
oracpux2.sql
oscpux.sql
oscpux1.sql
oscpux10.sql
oscpux2.sql
oscpux210.sql
osmclear.sql
osmi.sql
osmprep.sql
osmtitle.sql
osmtitlel.sql
osmtitlell.sql
osmtitlem.sql
osmtitles.sql
rbs.sql
rdohist.sql
readme.txt
rlog.sql
rtc.sql
rtcx.sql
rtio.sql
rtow.sql
rtpctx.sql
rtsess.sql
rtsess9.sql
rtsessx.sql
rtsum.sql
rtsys.sql
rtsysx.sql
rtsysx8.sql
sessinfo.sql
sessinfo9.sql
sesstat.sql
sga.sql
simsql1.sql
simsql2.sql
snap_stats.sql
spspinfo.sql
sqls1.sql
sqls18.sql
sqls19.sql
sqls2.sql
sqls3.sql
sqls4.sql
stu.sql
supers.sql
swenq.sql
swenqc.sql
swenqnew.sql
swenqx.sql
swhist.sql
swhist.sql.sav
swhistx.sql
swhistx.sql.sav
swpct.sql
swpctidle.sql
swpctx.sql
swpctxidle.sql
swsessid.sql
swsid.sql
swsw.sql
swswc.sql
swswp.sql
swsys.sql
sysstat.sql
tbfsum.sql
tcsizing.sql
tcstats.sql
test.sql
timechk.sql
topcpu
topdml.sql
tp.sql
tp9.sql
tsmap.sql
tss.sql
undo.sql
users.sql
-- ********************************************************************
-- * Copyright Notice   : (c)1998,1999,2002,2004 OraPub, Inc.
-- * Filename		: tss.sql 
-- * Author		: Craig A. Shallahamer
-- * Original		: 17-AUG-98
-- * Last Update	: 11-Mar-06
-- * Description	: Report Oracle tablespace free information
-- * Usage		: start tss.sql
-- ********************************************************************

def osm_prog	= 'tss.sql'
def osm_title	= 'Oracle Database Tablespace Space Summary'

start osmtitles

break on report
compute sum of totspace fspace uspace uextents ffrags on report

col tsname   format         a25 justify c heading 'Tablespace|Name' trunc
col totspace format      999990 justify c heading 'Total|Space|(MB)'
col fspace   format      999990 justify c heading 'Free|Space|(MB)'
col uspace   format      999990 justify c heading 'Used|Space|(MB)'
col pctusd   format         990 justify c heading 'Pct|Used'
col umaxext  format       99990 justify c heading 'Biggest|Data|Ext|(MB)'
col uextents format      999990 justify c heading 'Num of|Data|Exts'
col fmaxfrag format       99990 justify c heading 'Biggest|Free|Ext|(MB)'
col ffrags   format       99990 justify c heading 'Num Free|Exts'
col em       format         a5  trunc heading 'Ext|Mgt' trunc
col at       format         a5  trunc heading 'Alloc|Type' trunc

set termout off feedback off verify off
col val1 new_val db_block_size noprint
select value val1
from   v$parameter
where  name = 'db_block_size'
/
set termout on

select
  fx.ts_name		tsname,
  (fx.free_space+nvl(u.used_space,0))/1048576 totspace,
  nvl(fx.free_space/1048576,0)	fspace,
  nvl(u.used_space/1048576,0)	uspace,
  nvl(100*nvl(u.used_space,0)/(fx.free_space+u.used_space),0) pctusd,
  nvl(u.max_ext_size/1048576,0)	umaxext,
  nvl(u.num_exts,0)		uextents,
  fx.max_frag_size/1048576	fmaxfrag,
  fx.num_frags		ffrags,
  t.extent_management em, 
  t.allocation_type at
from
(
  select
    tablespace_name                     ts_name,
    sum(bytes)                          free_space,
    max(bytes)                          max_frag_size,
    count(bytes)                        num_frags
  from
    dba_free_space
  group by
    tablespace_name
  union
  select
    f.tablespace_name           ts_name,
    sum(f.blocks*&db_block_size)-nvl(sum(u.blocks*&db_block_size),0) free_space,
    -1                          max_frag_size,
    -1                          max_frags
  from
    dba_temp_files f,
    v$sort_usage   u
  where
    f.tablespace_name = u.tablespace (+)
  group by
    f.tablespace_name
) fx,
(
  select
    tablespace_name                     ts_name,
    sum(bytes)                          used_space,
    max(bytes)                          max_ext_size,
    count(bytes)                        num_exts
  from
    dba_extents
  group by 
    tablespace_name
union
  select
    tablespace                          ts_name,
    sum(blocks*&db_block_size)          used_space,
    max(extents)                        max_ext_size,
    count(extents)                      num_exts
  from
    v$sort_usage
  group by
  tablespace
) u,
  dba_tablespaces t
where
  fx.ts_name = u.ts_name(+) and
  t.tablespace_name = fx.ts_name
order by
  fx.ts_name
/

start osmclear



Know what's important before it's too late!



OraPub's
Performance Training

is like no other...




More Class Pics...
Get student testimonials!



Craig Shallahamer's Blog