Wednesday, July 29, 2009

Table close to allocating next extent

##Table close to allocating next extent

TABLE_SPACE_FREE=10 ## as a percentage of free space

TABLE_SIZE=10 ## in mb

EXTENT_SIZE=10 ## im mb

select dbsname, DBINFO('DBSPACE', systabnames.partnum),

tabname,

( ti_nptotal * 2 ) / 1024 mb_allocated,

ti_nextns extents,

( ti_nextsiz * 2 ) / 1024 mb_nextextent,

( ti_npused * 2 ) / 1024 mb_used,

(ti_nptotal - ti_npused ) * 2 / 1024 mb_free,

((ti_nptotal - ti_npused ) * 2 / 1024 ) / (( ti_nptotal * 2 ) / 1024) * 100 pct_free

from sysmaster:systabinfo, sysmaster:systabnames

where partnum = ti_partnum

and tabname not matches 'TBL*'

and dbsname not in ('sysmaster', 'sysutils')

and ((ti_nptotal - ti_npused) * 2 / 1024 )/((ti_nptotal * 2 ) / 1024) * 100 < $TABLE_SPACE_FREE

and ( ti_nptotal * 2 ) / 1024 > $TABLE_SIZE

and ( ti_nextsiz * 2 ) / 1024 > $EXTENT_SIZE

order by 6 desc, 9 asc


No comments: