DB2日常维护 Runstats脚本命令(Linux)
su - 到实例
/opt/sudo/sudo su - $instance
runstats 的 tablelist 生成
LANG=en_US
cd;pwd
db2 connect to $DB
db2 list tables for all show detail| grep -v "Table/View" | grep -v "\-\-" | grep -v "record(s)" | egrep -v '^$' | grep -v " V " | awk '{ print $2"."$1 }' > ./table.txt
表和索引进行runstats
for TABNAME in `cat ./table.txt`;do db2 runstats on table $TABNAME with distribution and detailed indexes all;done
———————– EOF ———————–