1--执行sql
yyyy3=`date +%Y -d "12 hour ago $date"`
mm3=`date +%m -d "12 hour ago $date"`
dd3=`date +%d -d "12 hour ago $date"`
hh3=`date +%H -d "12 hour ago $date"`
MM3=`date +%M -d "12 hour ago $date"`
Minutet3="$yyyy3""$mm3""$dd3""$hh3""$MM3"
echo $date $yyy3 $mm3 $dd3 $hh3 $MM3
AsqL0="drop table if exists test_"$Minutet3";"
AsqL1="create table test_"$Minutet3" as select * from sysdba.f_cza_satisfy_terminal_hour limit 0;"
echo $AsqL0 $AsqL1
/home/dmdba/dm8_dpc/bin/disql SYSDBA/SYSDBA@192.168.104.26:18331 -E "$AsqL0"
2--执行脚本
--该脚本最后一行带exit;
vi 1.sql 加以下脚本到里面
drop table if exists test;
create table test as select * from sysdba.f_cza_satisfy_terminal_hour limit 0;
exit;
执行方法
/home/dmdba/dm8_dpc/bin/disql SYSDBA/SYSDBA@192.168.104.26:18331 \`/ljl/tool/other/disql/1.sql
3 --执行脚本
drop table if exists test;
create table test as select * from sysdba.f_cza_satisfy_terminal_hour limit 0;
执行方法
/home/dmdba/dm8_dpc/bin/disql SYSDBA/SYSDBA@192.168.104.26:18331 <<EOF
start /ljl/tool/other/disql/1.sql
start /ljl/tool/other/disql/2.sql
exit
EOF