gu14 发表于 2010-10-11 00:33

自己写的导出重建索引SQL的脚本

dbschema -d database -t tablename -ss|awk '{if(/index/){printf $0" ";next;next} else{print $0}}'|grep create|grep index|sed -e 's/index/index!/g'|sed -e 's/on/!on/g'|awk -F "!" '{print "drop index "$2";;\n"$0}'

gu14 发表于 2010-10-11 00:43

if [ 2 != $# ]
then
   echo "use: $0 DBNAME TABLE"
   exit 1
fi
#dbschema -d $1 -t $2
dbschema -d $1 -t $2 -ss|grep -v "{ TABLE"|awk '{if(/index/){printf $0" ";next;next} else print $0}}'|grep create|grep index|sed -e 's/index/index!/g'|sed -e 's/on/!on/g'|awk -F "!" '{print "drop index "$2";\n"$0}'|sed -e 's/!//g'

msingle 发表于 2010-10-13 00:19

dintan 发表于 2011-03-19 09:06

我看了一下 代碼 ,好像是顯示index指令 并沒有執行吧:wink:
页: [1]
查看完整版本: 自己写的导出重建索引SQL的脚本