#!/bin/ksh # ====================================================================== # Richard Wilson - 13.03.2014 # Backup the database using Data Pump. # ---------------------------------------------------------------------- # History: # RW 02.06.2014 Minor modifications. # RW 24.06.2014 Parallelised. # EXPDP to ASM only. # RW 26.06.2014 Added ASM dump file deletion. # RW 04.09.2014 Use dynamic date, changed ORACLE_HOME. # Corrected errors in ASM purge. # RW 27.01.2016 Added error reporting after ASM copy. # # ====================================================================== # OWNER DIRECTORY_NAME DIRECTORY_PATH # ---------- -------------- ------------------------------------------- # SYS DUMPSET_LOGS /home/oracle/Scripts/RMAN/logs # SYS DUMPSETS +FRA/CONV/dumpset # ---------------------------------------------------------------------- export ORACLE_HOME="/u01/app/oracle/product/11.2.0/dbhome_1/" export ORACLE_SID=${1} # Check for log file, and if exists, rename. [ -f /home/oracle/Scripts/RMAN/logs/${ORACLE_SID}_`date '+%a'`_DMSIT_expdp.log ] && mv -f /home/oracle/Scripts/RMAN/logs/${ORACLE_SID}_`date '+%a'`_DMSIT_expdp.log /home/oracle/Scripts/RMAN/logs/old_${ORACLE_SID}_`date '+%a'`_DMSIT_expdp.log || : # Export the database to FRA. ${ORACLE_HOME}/bin/expdp expman/expdp@${ORACLE_SID} \ dumpfile=DUMPSETS:${ORACLE_SID}_`date '+%a'`_DMSIT_expdp.dmp \ directory=DUMPSETS \ full=Y \ logfile=DUMPSET_LOGS:${ORACLE_SID}_`date '+%a'`_DMSIT_expdp.log \ reuse_dumpfiles=y # Copy export file to /backups. #export ORACLE_SID=+ASM #export ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid #/u01/app/oracle/product/11.2.0/grid/bin/asmcmd cp +R5DISK/dmsit/dumpset/dmsit_`date '+%a'`_dmsit_expdp.dmp /backups/DMSIT/expdir/DMSIT_`date '+%a'`_dmsit_expdp.dmp #if [ $? -ne 0 ] #then # echo -e "\nWARNING: Could not write Export file to backup filesystem.\n" #fi # These last few lines were taken from the old CONV exports, not used by DMSIT, but left in for possible future use if necessary - RW:01.03.2017 # Purge old EXPDP files from ASM. # if [ $? -eq 0 ] # then # export ORACLE_SID="+ASM" # export ORACLE_HOME="/u01/app/oracle/product/11.2.0/grid" # # export ORACLE_SID="CONV" # last_day=`date +%a --date='3 days ago'` # ${ORACLE_HOME}/bin/asmcmd rm -f +fra/CONV/dumpset/CONV_${last_day}_daily_expdp_*.dmp # fi # =============================================================================================================