首页 > 开发 > 综合 > 正文

可以进行批量表删除的Informix数据库脚本

2024-07-21 02:42:54
字体:
来源:转载
供稿:网友
一个用于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 <<EOF 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

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表