Sunday, May 15, 2011

RMAN Script: DATAFILE RECOVERY


[datafile_recovery.scp]
# This section assumes that datafile 5 has been damaged and needs to be restored
 and recovered, and that the current controlfile and all other datafiles are int
act. the database is mounted during the restore and recovery.

# the steps are:
# - offlie the datafile that needs recovery
# - restore the datafile from backups
# - apply incrementals and archivelogs as necessary to recover.
# - make online recovered datafile

        run
        {
        sql 'alter database datafile 5 offline';

#if you want to restore to a different location,uncomment the following command
# Set newname for datafile 5 to '/newdirectory/new_filename.f';

        restore datafile 5;

# if you restored to a different locatin, uncomment the command below to
# switch the controlfile to point to the file in the new location
# SWITCH DATAFILE ALL;

        recover datafile 5;
        sql 'alter database datafile 5 online';
        }


No comments:

Post a Comment