在日常yy过程中我们可能会遇到需要定时执行相关sql,我们将sql写到shell脚本中并搭配定时任务来使用:
话不多说直接上脚本:
#!/bin/bash
TIME=`date "+%Y%m%d"`
TIMEALL=`date "+%Y-%m-%d %H:00:00"`
MYEAR='date "+Y%"`
#eacho "execl $TIMEALL" > a.out
/home/dmdba/dm/dmdbms/bin/disql SYSDBA/XXXXX << EOF
#start XXX.sql
#insert into "XXXX".XXXX" sleect * from "XXXX"."XXXXX" where create_time = '$TIMEALL';
#create table "SYSDBA"."TABLE_3" as select * from "SYSDBA"."TABLE_1";
#commit
EOF
评论已关闭