RMAN scripts for Oracle Database Cross Platform Migration

This is a technical brief which demonstrates how to concurrently migrate multiple oracle datafiles in a cross platform migration project. A SQL/Shell script generates the RMAN commands for migration.

Download Script and PDF below

rman_scripts_4_xplat_mig_rev_B.zip

The pdf document explain how to exploit this feature.

rman_scripts_4_xplat_mig_rev_B


#!/bin/kshDEST=/data1/oracle   ## target destination of the datafileSTAGE=/stage/oracle  ## staging area on target where converted file residesSEP="'"              ## single quote      SCOL=";"             ## semi-colonSLASH="/"            ## slashBG="' &"
if [ $USER = 'root' ]; then   echo "Cannot run as " $USER   echo "EXITING ..."    exitfi
if [ $USER = 'root' ]; then   echo "Cannot run as " $USER   echo "EXITING ..."    exitfi
# Check for Oracle environment
# End of Check for Oracle Environment

# Find out about the source platform  SOURCEPLATFORM=`sqlplus -s '/as sysdba' <<!   set heading off   select ''''||platform_name||'''' from v\\\$database; ! `## End of Source Platform checke
# `sqlplus -s '/ as sysdba' >db_files.lst <<!#   set heading off#   set feedback off#   select substr(file_name,(instr(file_name,'/',-1,1)+1),length(file_name))#   from dba_data_files;#   !#  `
sqlplus -s '/ as sysdba' <<ENDSQLspool db_files.lstset heading offset feedback off   select substr(file_name,(instr(file_name,'/',-1,1)+1),length(file_name)) from dba_data_files;spool offexit;ENDSQL
## get rid of the blank lines in the lst file with sed command     cat db_files.lst | sed '/^$/d' > db_files.lst## done
## Generate the rman  conversion script for individual datafiles       echo RUN > ${ORACLE_SID}_CONVERT.RMAN       echo ' {' >> ${ORACLE_SID}_CONVERT.RMAN      for file in `cat db_files.lst`     do  	echo RUN >> ${file}.rman  	echo ' {' >> ${file}.rman  	echo ' CONVERT DATAFILE ' ${SEP}$DEST${SLASH}${file}${SEP} >> ${file}.rman  	echo ' FROM PLATFORM ' $SOURCEPLATFORM >> ${file}.rman  	echo ' FORMAT '${SEP}${STAGE}${SLASH}${file}${SEP}${SCOL} >> ${file}.rman  	echo ' }' >> ${file}.rman        echo 'rman target=/ @'${file}.rman log=${SEP}${file}.log${BG} >> MASTER_${ORACLE_SID}.sh
 echo ' CONVERT DATAFILE ' ${SEP}$DEST${SLASH}${file}${SEP} >> ${ORACLE_SID}_CONVERT.RMAN  	echo ' FROM PLATFORM ' $SOURCEPLATFORM >> ${ORACLE_SID}_CONVERT.RMAN  	echo ' FORMAT '${SEP}${STAGE}${SLASH}${file}${SEP}${SCOL} >> ${ORACLE_SID}_CONVERT.RMAN        echo '                                                    ' >> ${ORACLE_SID}_CONVERT.RMAN      done  	echo ' }' >> ${ORACLE_SID}_CONVERT.RMAN

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s