asm2os.sh
#!/bin/bash # File: asm2os.sh # 2017.10.19: Initial Version # Local Path Vars XFER_BASE="/u01/xfer/sb_files" DATAFILE="$XFER_BASE/DATAFILE" TEMPFILE="$XFER_BASE/TEMPFILE" ONLINELOG1="$XFER_BASE/ONLINELOG1" ONLINELOG2="$XFER_BASE/ONLINELOG2" ARCHIVELOG="$XFER_BASE/ARCHIVELOG/2017_10_18" # ASM Path Vars ASM_DATAFILE="+DATA/oradb/DATAFILE" ASM_TEMPFILE="+DATA/oradb/TEMPFILE" ASM_ONLINELOG1="+DATA/oradb/ONLINELOG" ASM_ONLINELOG2="+FRA/ORADB/ONLINELOG" ASM_ARCHIVELOG="+FRA/ORADB/ARCHIVELOG/2017_10_18" # Confirmation printf "+------------------------------------+\n" printf "| About to Copy Files From ASM to OS |\n" printf "| Local files will be purged. |\n" printf "+------------------------------------+\n" printf "XFER_BASE: $XFER_BASE\n\n" read -p "Are you sure want to continue [y\n]? " -n 1 -r if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1 fi printf "\n\n" # Init Dirs printf "Init Dirs: $XFER_BASE...\n\n" rm -rf $XFER_BASE mkdir -p $DATAFILE mkdir -p $TEMPFILE mkdir -p $ONLINELOG1 mkdir -p $ONLINELOG2 mkdir -p $ARCHIVELOG chmod -R 776 /u01/xfer #read -p "Press [Enter] key to continue." # Copy Files printf "Processing: $ASM_DATAFILE\n" for i in $(asmcmd ls $ASM_DATAFILE); do asmcmd cp $ASM_DATAFILE/$i $DATAFILE/; done printf "Processing: $ASM_TEMPFILE\n" for i in $(asmcmd ls $ASM_TEMPFILE); do asmcmd cp $ASM_TEMPFILE/$i $TEMPFILE/; done printf "Processing: $ASM_ONLINELOG1\n" for i in $(asmcmd ls $ASM_ONLINELOG1); do asmcmd cp $ASM_ONLINELOG1/$i $ONLINELOG1/; done printf "Processing: $ASM_ONLINELOG2\n" for i in $(asmcmd ls $ASM_ONLINELOG2); do asmcmd cp $ASM_ONLINELOG2/$i $ONLINELOG2/; done printf "Processing: $ASM_ARCHIVELOG\n" for i in $(asmcmd ls $ASM_ARCHIVELOG); do asmcmd cp $ASM_ARCHIVELOG/$i $ARCHIVELOG/; done # End printf "\nProcess Completed \n\n"