if [ "$#" -ne "2" ]
then
echo "useage: $0 dbname user"
exit
fi
dbsname="$1"
owner="$2"
#取表名
echo "unload to tmp.txt
select tabname from systables where owner='$owner' order by 1;" > table.sql
dbaccess $dbsname table.sql
awk -F"|" '{print $1}' tmp.txt >tables.txt
rm tmp.txt
#生成统计各表记录数的sql语句
echo "unload to count_inf.txt" > tmp.sql
for i in `cat tables.txt`
do
echo "select '$i',trunc(count(*),0)||\"\" from $i
union all">>tmp.sql
done
sed '$d' tmp.sql > file.sql
echo ";" >>file.sql
rm tmp.sql
#统计各表行数,结果到count_inf.txt
dbaccess $dbsname file.sql
rm table.sql file.sql tables.txt