Tuesday, 26 May 2020

Crontab - Expdp Scripts with mail example

###########################  EXPDP ###########################


Crontab Details :

25 06 * * * /u04/MasterDB/scripts/expdp_smrprodb_full.sh 2>&1 >>/u04/MasterDB/expdp/RODB_FULL.log | mail -s "EXPDP Production database backup logs" varun.yadav@mailid.com


Script Output :

oracle@test02:~> cat /u04/MasterDB/scripts/expdp_smrprodb_full.sh

export ORACLE_BASE=/u02/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1

export ORACLE_SID=PRODB

export PATH=$PATH:$ORACLE_HOME/bin

 expdp abc/abc@PRODB dumpfile=expdp-$(date +%Y-%m-%d_%H-%M-%S).dmp directory=expdp logfile=expdp-$(date +%Y-%m-%d_%H-%M-%S).log FULL=Y EXCLUDE=STATISTICS CONTENT=ALL JOB_NAME=FULL_EXPDP_PRODB parallel=2

#Moving log files

mv /u04/MasterDB/expdp/expdp*.log /u04/MasterDB/expdp/expdp_fulldb_backup_logs

#Granting permissions for Dump files

chmod -R 775 /u04/MasterDB/expdp/

#Compressing files

gzip /u04/MasterDB/expdp/*.*

#Removing 2 days old dump files

#find /u04/MasterDB/expdp/ -mtime +2 -exec rm {} \;

No comments:

Post a Comment