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

Wednesday, June 13, 2007

restore_spfile.ksh

This script is for restoring the spfile from disk to default location


#!/bin/ksh
. ~/.profile

##
## script name : restore_spfile.ksh
## Author : Ramakrishna Nemani
##
## Purpose :
## This script is for restoring the spfile from disk to default location.
##
## Note :
## You have to replace DBID value with the DBID that you are attempting to restore the spfile for.
## To execute this script You need login as a unix id that belongs to DBA group.
## 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_spfile.log

CONNECT TARGET /

STARTUP FORCE NOMOUNT;

##
## set dbid because we are not using an rman catalog
##
SET DBID 3183102432 ;

##
## Specify AUTOBACKUP Format
##
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'controlfile_%F' ;
##
## Restore spfile from autobackup first
##
RUN {
ALLOCATE CHANNEL disk_1 DEVICE TYPE disk ;
RESTORE SPFILE FROM AUTOBACKUP ;
}
##
## Restart the database with newly restored SPFILE
##
SHUTDOWN IMMEDIATE;
STARTUP ;

EOF
##
## End of restore_spfile.ksh
##

No comments:

Post a Comment