comp.databases.informix.dba-tools: An improved "dspace" program
Posted in 1995
As I post this, I'm scrambling to find the original authors' name, but to
no avail. So please accept my apologies to the original author of "dspace"
for not mentioning your name. I wrote an improved version included here:
#!/bin/sh
###############################################################################
# dspace: tbstat -d implementation
# usage: dspace
# author: ( improved version )
# Tim Schaefer, The Computer Business Co., Inc.
# latest: Sat Jul 22 08:04:36 EDT 1995
# notes: Works for INFORMIX On-Line 5.02
# This is an improved version of a posted "dspace" routine in c.d.i.
# The advantage to this version: no /tmp files and formatted output.
# Unsure of 7.1 usage - not tested. STAT_VERSION allows soft-coding of
# either tbstat or onstat. May need to use "awk" instead of "nawk".
# Should run a bit faster than the original posted "dspace". The
# usage of the match may not be reliable.
###############################################################################
STAT_VERSION=tbstat
AWK=nawk
$INFORMIXDIR/bin/${STAT_VERSION} -d | $AWK '
BEGIN {
{ printf("\\n%-30s %15s %15s %7s\\n", "DBSpace Name","Total Pages", "Free Pages", "% Full" ) }
{ printf("================================================================================\\n")}
name = ""
trap=0; ttl_pgs=0; ttl_fpgs=0 ;
}
{
{ if ( $1 == "DBSpaces" ) { trap=0 } }
{ if ( $1 == "Chunks" ) { trap=1 } }
{ if ( trap == 1 )
{
{ if ( match ( $8, "/" ) != 0 )
{
{ printf("%-30s %15d %15d %7.2f\\n", $8, $5, $6, (($6/$5)*100) ) }
ttl_pgs+=$5 ; ttl_fpgs+=$6
}
}
}
}
}
END {
{ printf("%30s %15d %15d\\n", "Total Pages and Free Pages:", ttl_pgs, ttl_fpgs ) }
{ printf("================================================================================\\n")}
}
'
# end dspace
--
\\\\|//
(O|O)
==============================---o00--(_)--00o---============================
Tim Schaefer tschaefe@gate.net http://www.gate.net/~tschaefe
Make America great again: Abolish the IRS and reinstitute public hangings
=============================================================================