首页 > 开发 > 综合 > 正文

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

2024-07-21 02:42:16
字体:
来源:转载
供稿:网友
 

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. /n/n", ENVIRON["DBNAME"], size )}' $TMPFILE >; $RESULTcat $TMPFILE >;>; $RESULTview $RESULTrm -f $TMPFILE

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表