Today's Birthday
Quote of the Day
This Day in History

Saturday, June 16, 2007

Restore datafile from disk (restore_datafile.ksh)

This script restores datafile from disk to the original location.


#!/bin/ksh
. ~/.profile

##
## script name : restore_datafile.ksh
## Author : Ramakrishna Nemani
##
## Purpose :
## This script is for restoring and recovering a datafile from disk.
##
## Note :
## To execute this script You need login as a unix id that belongs to DBA group.
## Make sure you have configured the rman automatic channels etc..
## I have tested this script on UNIX/LINUX platform using Oracle 10g.
## Use it at your own risk.
##
## This is an example or sample script
##

export ORACLE_SID=stgd

rman << EOF > ./rstr_datafile.log

connect target /

##
## Specify the datafile# to be restored and recovered
##
sql "alter database datafile 6 offline" ;
restore datafile 6 ;
recover datafile 6 ;
sql "alter database datafile 6 online" ;

EOF

No comments:

Post a Comment