数据库

#!/bin/sh
dateStr=`date +"%Y%m%d"`
echo    "Date=$dateStr"
export  ORACLE_BASE=/date/oracle
export  ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export  LD_LIBRARY_PATH=:$ORACLE_HOME/lib:/use/lib:/usr/local/lib
export  PATH=$ORACLE_HOME/bin:/usr/bin:/bin
export  ORACLE_SID=orcl
export  NLS_LANG=AMERICAN_AMERICA.AL32UTF8
. /home/oracle/.bash_profile
echo "starttime" `date` >> /bak/zbx_bak_time.txt
#exp user/passwd@SID file=/bak/bak_$dateStr.dmp  log=bak_$dateStr.log
echo "filename" bak_$dateStr.dmp >> /bak/zbx_bak_time.txt
echo "endtime" `date` >> /bak/zbx_bak_time.txt
###tar the files
     dbbak=bak_$dateStr.dmp.tar.gz
     tar -czvf  $dbbak  /bak/bak_$dateStr.dmp
cd /bak
scp bak_$dateStr.dmp.tar.gz [email protected]:/oracle/oracle/orabak
###del the files before 10 day
find /bak -name "*.tar.gz" -type f -mtime +30 -exec rm {} \; > /dev/null 2>&1
find /bak -name "*.dmp" -type f -mtime +1 -exec rm {} \; > /dev/null 2>&1
find /bak -name "*.log" -type f -mtime +1 -exec rm {} \; > /dev/null 2>&1




#jjdt
#00 18 30 * *  /home/utrs/mysh/jjdt.sh
#!/bin/bash
export BAKUPTIME1=`date  +%Y%m%d%H%M%S`
export DATA_DIR=/tmp
webbak=jjdt_$BAKUPTIME1.tar.gz
cd /home/utrs/jjdt/webapps/ROOT
tar -Pzcf /tmp/$webbak .

#portal
#00 18 30 * *  /home/utrs/mysh/portal.sh
#!/bin/bash
export BAKUPTIME1=`date  +%Y%m%d%H%M%S`
export DATA_DIR=/tmp
webbak=portal_$BAKUPTIME1.tar.gz
cd  /home/utrs/portal/webapps/portal
tar -Pzcf /tmp/$webbak .

#houtai
#00 18 30 * *  /home/utrs/mysh/houtai.sh
#!/bin/bash
export BAKUPTIME1=`date  +%Y%m%d%H%M%S`
export BAKUPTIME2=`date  +%Y%m%d`
export DATA_DIR=/tmp/$BAKUPTIME2
mkdir -p $DATA_DIR
webbak=sso_$BAKUPTIME1.tar.gz
cd /home/utrs/sso/webapps/ROOT && tar -Pzcf $DATA_DIR/$webbak .
webbak2=utrm_$BAKUPTIME1.tar.gz
cd /home/utrs/utrm/webapps/utr-web && tar -Pzcf $DATA_DIR/$webbak2 .
webbak3=uct_$BAKUPTIME1.tar.gz
cd /home/utrs/uct/webapps/sweb && tar -Pzcf $DATA_DIR/$webbak3 .
webbak4=flow_$BAKUPTIME1.tar.gz
cd /home/utrs/flow/webapps/flow && tar -Pzcf $DATA_DIR/$webbak4 .
webbak5=utrj_$BAKUPTIME1.tar.gz
cd /home/utrs/utrj/webapps/utrj && tar -Pzcf $DATA_DIR/$webbak5 .



你可能感兴趣的:(数据库)