欢迎投稿

今日深度:

一个批量删除临时表的sh用于informix

一个批量删除临时表的sh用于informix


#!/bin/csh
if ($#argv != 1   then
echo "Usage:csh deltmp.sh [dbname]";
exit(0);
else if ($#argv == 1  then
set dbname="$argv[1]";
endif
rm deltmp*.sql
echo "now load tmp table to deltmp.sql"
dbaccess $dbname <unload to "deltmp.sql"
select tabname from systables where tabname like "tmp%" and created < extend(current,year to day)
EOF
echo "load finish"
echo "| --> ;"
sed 's/|/;/w deltmp1.sql' deltmp.sql
echo "tmp --> drop table tmp"
sed 's/tmp/drop table tmp/w deltmp2.sql' deltmp1.sql
echo "delete temp table"
dbaccess $dbname deltmp2.sql
echo "delele temp files"
rm deltmp*.sql

www.htsjk.Com true http://www.htsjk.com/shujukugl/18531.html NewsArticle 一个批量删除临时表的sh用于informix #!/bin/csh if($#argv!=1then echo"Usage:cshdeltmp.sh[dbname]"; exit(0); elseif($#argv==1then setdbname="$argv[1]"; endif rmdeltmp*.sql echo"nowloadtmptabletodeltmp.sql" dbaccess$dbname unloadto"...
评论暂时关闭