Wednesday, July 4, 2018

Migrating & Upgrading Oracle 11G to 12c Database


Migrating & Upgrading Oracle 11.2.0.4 to 12c Database

Copy the the Oracle Home from "tar -cvf oh.tar $ORACLE_HOME "  to new server

 export ORACLE_HOME=/u01/data/db/11.2.0.4
 export ORACLE_BASE=/u01/data/
 export PATH=$ORACLE_HOME/bin:$PATH
 export ORACLE_SID=PROD


./runInstaller -silent -clone ORACLE_BASE="/u01/data/" ORACLE_HOME="/u01/data/db/11.2.0.4" ORACLE_HOME_NAME="OraHome1"

 ./relink all

writing relink log to: /u01/data/db/11.2.0.4/install/relink.log


---./runInstaller -silent -attachHome -invPtrLoc /etc/oraInst.loc \ ORACLE_HOME="/u01/data/db/11.2.0.4" ORACLE_HOME_NAME="OraHome1"

orapwd file=$ORACLE_HOME/dbs/orapwPROD password=Welcome1 force=y

Take Rman backup of Source Database

rman target /


run

{
CONFIGURE CONTROLFILE AUTOBACKUP ON;
allocate channel c1 type disk format '/stage/Backup/%U';
allocate channel c2 type disk format '/stage/Backup/%U';
allocate channel c3 type disk format '/stage/Backup/%U';
allocate channel c4 type disk format '/stage/Backup/%U';
sql 'alter system archive log current';
BACKUP AS COMPRESSED BACKUPSET DATABASE;
sql 'alter system archive log current';
BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL;
backup CURRENT CONTROLFILE format '/stage/Backup/cntrl_%s_%p_%t';
RELEASE CHANNEL c1;
RELEASE CHANNEL c2;
RELEASE CHANNEL c3;
RELEASE CHANNEL c4;
}


Clone DB from Source Backup

Bring up the instance in nomount

sqlplus "/as sysdba"
startup nomount pfile='/u01/data/db/11.2.0.4/dbs/initPROD.ora'
(Edit the Control file .archive log paths accordingly to the the new 12c Home / Mount points)

Connect to Auxiliary instance to clone the DB from RMAN backup

rman auxiliary sys/Welcome1


run {
allocate AUXILIARY channel c0 type disk;
allocate AUXILIARY channel c1 type disk;
allocate AUXILIARY channel c2 type disk;
allocate AUXILIARY channel c3 type disk;
allocate AUXILIARY channel c4 type disk;
allocate AUXILIARY channel c5 type disk;
allocate AUXILIARY channel c6 type disk;
allocate AUXILIARY channel c7 type disk;
duplicate target database to "PROD" BACKUP LOCATION '/stage/Backup/' NOFILENAMECHECK;
RELEASE CHANNEL c0;
RELEASE CHANNEL c1;
RELEASE CHANNEL c2;
RELEASE CHANNEL c3;
RELEASE CHANNEL c4;
RELEASE CHANNEL c5;
RELEASE CHANNEL c6;
RELEASE CHANNEL c7;
}


Install the 12c Binaries under /u01/oracle12c/  by invoking ./runInstaller  from Install directory

Set the ORACLE_HOME and PATH variables pointing to newly installed ORACLE 12C Binaries
export ORACLE_HOME=/u01/oracle12c/dbhome/product/12.1.0
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=PROD

Got to cd $ORACLE_HOME/bin  and invoke  ./dbua




No comments: