1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| #!/bin/bash
USERNAME=system PASSWORD=yourpass SID=orcl SCHEMA=yoursid DUMP_DIR=/home/oracle/dump DIRECTORY=BAKDIR PARALLEL=1 DMP_FILE=BAK_`date +%Y%m%d%H%M%S`.dmp LOG_FILE=BAK_`date +%Y%m%d%H%M%S`.log
expdp $USERNAME@$SID/$PASSWORD schemas=$SCHEMA DIRECTORY=$DIRECTORY DUMPFILE=$DMP_FILE logfile=$LOG_FILE parallel=$PARALLEL;
cd $DUMP_DIR gzip $DMP_FILE
find $backup_dir -name "*.dmp" -mtime +1 -exec rm {} \;
|