Oracle Export ( Data pump ) Shell script
cat oraexpdb.sh
# !/bin/bash
TODAY=`date`
ORACLE_SID=db ; export ORACLE_SID
ORACLE_BASE=/opt/oracle ; export ORACLE_BASE
ORACLE_HOME=/opt/oracle/product/10.2 ; export ORACLE_HOME
PATH=${ORACLE_HOME}/bin:$PATH ; export PATH
EXPFILE=$ORACLE_SID.datapump.`date +%m%d%Y`.dmp; export EXPFILE
ERRFILE=$ORACLE_SID.datapump.`date +%m%d%Y`.err; export ERRFILE
LOGFILE=$ORACLE_SID.datapump.`date +%m%d%Y`.log ; export LOGFILE
SUCC=/opt/oracle/backup/DataPump/Backup/SUCC.txt ; export SUCC
# echo $EXPFILE
ps -ef | grep -i smon|grep -v grep|wc -l> oracle.exp
if [ `cat oracle.exp|grep -v grep|grep -i "1"|wc -l` -eq 1 ]; then
[ -f $ERRFILE ]; rm $ERRFILE
expdp "'/ as sysdba'" directory=datapump DUMPFILE=$EXPFILE SCHEMAS=PROD1,UAT2,ESEARCH logfile=$LOGFILE EXCLUDE=STATISTICS parallel=4
fi
echo "-------------- Deleting old File ----------------------"
find /opt/oracle/backup/DataPump/Backup -name "*.err" -ctime +2 -exec rm {} \;
find /opt/oracle/backup/DataPump/Backup -name "*.dmp*" -ctime +2 -exec rm {} \;
# find /opt/oracle/backup/DataPump/Backup -name "$ORACLE_SID.export.*" -mtime +2 -exec rm {} \;
echo "Done........ "
exit 0
No comments:
Post a Comment