一个批量删除临时表的sh用于informix
#!/bin/cshif ($#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 <
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
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。