- Oracle数据库
ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1;export ORACLE_HOMEORACLE_SID=dypwbak2;export ORACLE_SIDtdate=$1starttime=`date +'%Y-%m-%d %H:%M:%S'`$ORACLE_HOME/bin/sqlplus -S '/ as sysdba' << EOF set pagesize 0 feedback off verify off heading off echo off CONN xxx/yyy; # sql部分EXIT;EOFecho 'Begin:'$starttime 'end:'`date +'%Y-%m-%d %H:%M:%S'` $tdate 'finished.'
- MySQL数据库
myarray=`mysql -u$varuser -p$varpass -h127.0.0.1 -e "SELECT ipaddr,maxid FROM labdb.t_etl_status WHERE starttime>'$etlstarttime' AND endtime>'$etlstarttime'" | awk '{print $1"|"$2}'`