Monday, March 9, 2015

Move files from asm to filesystem shell script

#!/bin/bash
#
# This script copies files from FRA on ASM to local disk
#
ORACLE_SID=+ASM1
GRID_HOME=/u01/app/11.2.0/grid
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
ASMLS=/home/oracle/asm_ls.txt
FRA=+DATA/FINAL/DATAFILE/
LOCALBACKUPDIR=/u01/
LOG=/u01/asm_log.txt
#
# Get the list of files
#
cd $GRID_HOME/bin/
./asmcmd > $ASMLS <<EOF
ls $FRA
exit
EOF
#
# Clean the list by removing "ASMCDM>"
#
sed -i 's/ASMCMD> //g' $ASMLS
cat $ASMLS
echo `date` > $LOG
#
# Copy files one by one
#
for FILENAME in `cat $ASMLS`
do
./asmcmd >> $LOG <<EOF
cp $FRA/$FILENAME $LOCALBACKUPDIR
EOF
done
cat $LOG

No comments:

Post a Comment

Featured Post

Apply Patch 22191577 latest GI PSU to RAC and DB homes using Opatch auto or manual steps

Patch 22191577: GRID INFRASTRUCTURE PATCH SET UPDATE 11.2.0.4.160119 (JAN2016) Unzip the patch 22191577 Unzip latest Opatch Version in or...