PROGRESS數據庫整理以后的數據自動確認
PROGRESS 數據庫 優化的一個很有效的途徑,就是把所有數據表數據導出來,然后再新建一個同名數據庫,再把數據導進去,然后做索引重建,我們把這種行為叫做吃飽了撐著(哈哈,當然不是啦,叫DBRe-filing)!這樣做的最大好處是: 1、減少了數據庫的容量; 2、
PROGRESS數據庫優化的一個很有效的途徑,就是把所有數據表數據導出來,然后再新建一個同名數據庫,再把數據導進去,然后做索引重建,我們把這種行為叫做吃飽了撐著(哈哈,當然不是啦,叫DB Re-filing)!這樣做的最大好處是:
1、減少了數據庫的容量;
2、提高數據庫性能。
但是這樣一個過程是很繁瑣的,特別是對比前后數據庫的記錄,如果數據表很多的時候!
本文內容部分,就是一個shell腳本,用來自動確認數據庫re-filing前后的數據是否一致。
QAD的MFG/PRO系統一般有個菜單用來打印數據庫容量,可以利用這個功能,對比re-filing前后的運行結果------#!/usr/bin/sh
# DB-Refiling Tables & Records Checking
# ---Old file ---New file
#Set default file(s)
if [ "" = "" ]
then
old_file="actdb.prn"
else
old_file=
fi
if [ "" = "" ]
then
new_file="actdbnew.prn"
else
new_file=
fi
#Check if the two files are exist
cd /mfg/ptmp
if [ ! -f ./$old_file ]
then
echo "Warning: $old_file does not exist!"
exit
fi
if [ ! -f ./$new_file ]
then
echo "Warning: $new_file does not exist!"
exit
fi
echo "Start checking tables......"
# Get old tables
more $old_file|grep -v "mgdbrp.p"|grep -v "Networks" >./$$.dbref
more $$.dbref|grep -v "/"|grep -v "root"|tr -d "," >./$$.dbref1
awk '>=0 && <=10000000 {print " " }' $$.dbref1 >./$$.dbref1i
old_tbl=`more $$.dbref1i|wc -l`
# Get new tables
more $new_file|grep -v "mgdbrp.p"|grep -v "Networks" >./$$.dbref
more $$.dbref|grep -v "/"|grep -v "root"|tr -d "," >./$$.dbref2
awk ' >=0 && <= 10000000 {print " " }' $$.dbref2 >./$$.dbref2i
new_tbl=`more $$.dbref2i |wc -l`
echo "There are $old_tbl tables in the old DB!"
echo "There are $new_tbl tables in the new DB!"
echo "Done!"
if [ $old_tbl -eq $new_tbl ]
then
echo "Congratulation, the number of the tables is same!"
else
echo "Error: the number of the tables is different!"
fi
echo ""
echo "Start checking records......"
nerror=0
# Check records of each table
awk ' >= 0 && <= 10000000 {print " " }' $$.dbref1i |while read tlo cnto
do
cntn=`grep -i "^$tlo " $$.dbref2i|awk '{print }'`
if [ ! "$cntn" = "$cnto" ]
then
echo "The records of $tlo changed! "$cntn" <== "$cnto""
let nerror=$nerror+1
fi
done
echo "Done!"
if [ $nerror -ne 0 ]
then
echo "Errors:there are $nerror table(s)' records different!"
else
echo "Contrats! Records dump & load OK."
fi
# Clearing temp
rm $$.dbref
rm $$.dbref1
rm $$.dbref2
rm $$.dbref1i
rm $$.dbref2i
unset old_file
unset new_file
unset old_tbl
unset new_tbl
unset nerror
原文轉自:http://www.kjueaiud.com
老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月
|