ustbwang 发表于 2018-9-7 07:56:13

centos上oracle数据库自动备份

#!/bin/sh  

  
    export ORACLE_BASE=/home/oracle/app/oracle
  
    export ORACLE_HOME=$ORACLE_BASE/db11g
  
    export ORACLE_SID=X
  
    export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
  

  
    export DATA_DIR=/home/oracle/oraclebak
  

  
    export DEL_TIME=`date -d "5 days ago" +%Y%m%d`
  
    export BAKUP_TIME=`date +%Y%m%d%H%M%S`
  
    echo "Starting bakup..."
  
    echo "Bakup file path $DATA_DIR/$BAKUPTIME.dmp"
  
    expdp system/'密码' directory=expdata dumpfile=$BAKUP_TIME.dmp full=y logfile=$BAKUP_TIME.log
  

  
    echo "Delete the file bakup before 5 days..."
  
    rm -rf $DATA_DIR/$DEL_TIME*.dmp   $DATA_DIR/$DELTIME*.log
  
    echo "Delete the file bakup successfully. "


页: [1]
查看完整版本: centos上oracle数据库自动备份