#! /bin/ksh usage() { echo "$0 " exit 1 } if [ $# -ne 2 ] ; then usage fi BACKUPPIECE_NAME=$1 ARCHIVE_DEST=$2 if [ ! -d ${ARCHIVE_DEST} ] ;then echo "${ARCHIVE_DEST} n'est pas un repertoire." usage fi if [ ! -f ${ARCHIVE_DEST} ] ;then echo "${BACKUPPIECE_NAME} n'est pas un fichier." usage fi MIN_SEQ=`strings $BACKUPPIECE_NAME | grep "Seq#" | cut -f 4 -d " " | sort | head -1 | tr -d ","` MAX_SEQ=`strings $BACKUPPIECE_NAME | grep "Seq#" | cut -f 4 -d " " | sort | tail -1 | tr -d ","` echo "Restore from seq:$MIN_SEQ to seq:$MAX_SEQ" sqlplus -s "/ as sysdba" < '',ident => 'FUN'); dbms_backup_restore.RestoreSetArchivedLog(destination=>'$ARCHIVE_DEST'); for i in $MIN_SEQ..$MAX_SEQ loop begin dbms_backup_restore.RestoreArchivedLog(thread=>1,sequence=>i); exception when others then null; end; end loop; dbms_backup_restore.RestoreBackupPiece(done => done,handle => '$BACKUPPIECE_NAME', params => null); dbms_backup_restore.DeviceDeallocate; END; / EOF