Lin Hong's TECH Blog! 刀不磨要生锈,人不学习要落后 - Thinking ahead

[原创]DB2 Runstat 统计信息脚本命令(Linux)

2016-01-30
DB2

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 ———————–


上一篇 Github ssh 提交

Comments