Informix中查询database和table的占用空间

【字号: 日期:2023-08-18浏览:42作者:雯心

Informix数据库中查询database和table占用空间的实例脚本:

#!/usr/bin/shif [ $# -ne 1 ]then echo ' Usage: dbsize.sh DBNAME ' exitfiDBNAME=$1; export DBNAMETMPFILE=/tmp/dbsize.tmpRESULT=dbsize.outexport TMPFILE RESULTdbaccess << !database sysmaster;unload to '$TMPFILE' delimiter '|'select dbsname,tabname,count(*) num_of_extents,sum( pe_size ) total_sizefrom systabnames, sysptnextwhere partnum = pe_partnum and dbsname='$DBNAME'group by 1, 2order by 3 desc, 4 desc;!awk -F '|' ' BEGIN { size=0; }{ size = size + $4}END { printf (' The Database Size of %s is %d pages. nn', ENVIRON['DBNAME'], size )}' $TMPFILE >$RESULTcat $TMPFILE >;>$RESULTview $RESULTrm -f $TMPFILE

相关文章: