#!/usr/bin/ksh
###############################################################################
#
# Module: dbsfree.sh
#
# Description: List dbspaces used persent (uses sysmaster)
#
# Change Log
#
# Date Name Description.................
# 2005/11/04 James Guan Start Program
# 2009/08/05 prefect huang modify
#
###############################################################################
OUTPUT=dbsfree.out
TMPFILE=dbsfree.tmp
XDATE=`date +%D-%T`
MACHINE=`uname -n`
if [ -f $OUTPUT ]
then
rm -f $OUTPUT
fi
#-----------------------------------------------------------
echo "Collecting dbs/chunk info from the sysmaster database..."
dbaccess sysmaster <unload to $TMPFILE delimiter "|"
select dbs.dbsnum,
dbs.name,
dbs.nchunks,
sum(chksize),
sum(nfree)
from sysdbspaces dbs,syschunks chk
where dbs.dbsnum=chk.dbsnum
group by 1,2,3
order by 1
EOF
echo
echo "Completed - formatting report..."
echo
#--------------------------------------------------------------
awk ' \
BEGIN {
FS="|"
}
{
if (NR == 1) {
split (xdate,b,"-")
udate=b[1]
utime=b[2]
printf "\n%s %s Informix Dbspaces Report for ", udate, utime, server, machine
print "Dbsnum Dbsname Chunknum Dbssize(Page) Dbsfree(Page) FreePresent(%)\n"
}
dbsnum = $1
dbsname = $2
chunknum= $3
dbssize = $4
dbsfree = $5
fpercent =dbsfree/dbssize*100
printf "%3d %-15s%5d%18d%18d\t%10.1f\n", dbsnum,dbsname,chunknum,dbssize,dbsfree,fpercent
}
END {
}
' xdate=$XDATE machine=$MACHINE server=$INFORMIXSERVER $TMPFILE > $OUTPUT
#rm -f $TMPFILE
#pg $OUTPUT
less $OUTPUT
echo
echo "Note: Output report is in $OUTPUT"
阅读(1033) | 评论(0) | 转发(0) |