Oracle Database migration to a remote Data Protector cell--Best practices

38
Appendix E: Script to restore the SPFILE and Control File
providing the Backupset.
These scripts may help you to perform the restore of the SPFILE and Control File from within a Data
Protector Session, by providing the different objects to the RMAN restore command. It can be used in
the case neither recovery catalog nor Control File autobackup is available.
Assume the session we want to restore from is ‘2008/05/08-3. It many need to be changed
based on your requirements and environment.
Restore of the SPFILE providing the session ID:
# Main script to restore the SPFILE
# Script calls restore_spfile.sh
for i in `omnidb -sess 2008/05/08-3 | awk '{print $1}' | grep dbf | sort`
do
echo ' '
echo ================================================================================
echo Running restore with Object $i
echo ================================================================================
echo ' '
if [ -f $ORACLE_HOME/dbs/spfile$ORACLE_SID.ora ]
then break 2
fi
/home/oracle/restore_spfile.sh $i
done
# restore_spfile.sh
rman << EOF
set dbid=38758237 ;
connect target / ;
startup force nomount;
run {
allocate channel dev_0 type sbt_tape;
restore spfile from "$1" ;
}
EOF
Restore of the Control File providing the session ID:
# Main script to restore the controlfile
# Script calls restore_ctl.sh
for i in `omnidb -sess 2008/05/08-3 | awk '{print $1}' | grep dbf | sort`
do
echo ' '
echo ================================================================================
echo Running restore with Object $i
echo ================================================================================
echo ' '
if [ -f $ORACLE_HOME/dbs/spfile$ORACLE_SID.ora ]
then break 2
fi
/home/oracle/restore_ctl.sh $i
done
# restore_ctl.sh
rman << EOF
set dbid=38758237 ;
connect target / ;
run {
allocate channel dev_0 type sbt_tape;
restore controlfile from "$1" ;
}
EOF