#!/bin/ksh
. ~/.profile
##
## script name : restore_datafile_new.ksh
## Author : Ramakrishna Nemani
##
## Purpose :
## This script is for restoring datafile to a new location/name
## and recovering it.
##
## 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=slsd
rman << EOF > ./rstr_datafile_new.log
connect target /
##
## Specify the datafile# to be restored and recovered
## Specify new location/name
##
run
{
allocate channel disk_1 device type disk ;
sql "alter database datafile 6 offline" ;
set newname for datafile '/u02/oradata/slsd/users01.dbf' TO '/u02/oradata/slsd/new_users01.dbf' ;
restore datafile 6 ;
switch datafile 6 ;
recover datafile 6 ;
sql "alter database datafile 6 online" ;
}
EOF




No comments:
Post a Comment