Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Database Migration & Upgrade 11g to 12c, Non ASM to ASM, Non RAC to RAC

Consider a Typical Database Migration which contains all of this below (and if down time is not a problem)

1. Into a new Database Host (NEW SERVER)

2. Convert to Non-ASM to ASM

3. Convert to Single Instance to  RAC,

4. Upgrade to Database to 12c

Environment Details

Source Target

DB Version: 11.2.0.4 DB Version: 12.1.0.2

Instance Type : Standalone Instance Type : RAC

Storage: Non - ASM Storage Type: ASM

##################################################################################

Step 1:- In order to upgrade or convert to rac We must install 11g software as non - rac assuming installed in Target side

##################################################################################

Assuming its already installed here, Oracle_Home: /u01/app/oracle/11.2.0.4/db_1

###################################################################################

Step 2:- Create Tnsnames.ora and Listener.ora (separate) in 11.2.0.4 home in target side

###################################################################################

in new 11g home

tnsnames.ora

dbdup =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = target.localdomain)(PORT = 1522))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = dbname.localdomain)

dbname =

(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = source.localdomain)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = dbname.localdomain)

listener.ora

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = dbname.localdomain)

(ORACLE_HOME = /ora/app/oracle/product/12.1.0.1/db_1)

(SID_NAME = dbname)

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = target.localdomain)(PORT = 1522))

Start the listener

cd /u01/app/oracle/11.2.0.4/db_1/network/admin

lsnrctl start

###################################################################################

Step 3:- Copy password file to target machine

###################################################################################

On source

scp $ORACLE_HOME/dbs/orapwdbname target:$ORACLE_HOME/orapwdbname

###################################################################################

Step 4:- Take a pfile copy in source database and copy it

###################################################################################

sqlplus / as sysdba

create pfile='/tmp/initdbname.ora' from spfile;

###################################################################################
Step 5:- Modify the parameter file especially the following

###################################################################################

*.control_files='+DATA','+DATA'

*.db_create_file_dest='+DATA'

*.db_recovery_file_dest='+FRADG'

*.log_archive_dest_1='location=+FRADG'

#######################################################

Sample File

#######################################################

dbname.__data_transfer_cache_size=0

dbname.__db_cache_size=536870912

dbname.__java_pool_size=16777216

dbname.__large_pool_size=150994944

dbname.__oracle_base='/ora/app/oracle'

dbname.__pga_aggregate_target=671088640

dbname.__sga_target=989855744

dbname.__shared_io_pool_size=50331648

dbname.__shared_pool_size=218103808

dbname.__streams_pool_size=0

*.compatible='12.1.0.2.0'

*.control_files='+DATA','+DATA'

*.db_block_size=8192

*.db_domain='localdomain'

*.db_name='dbname'

*.db_create_file_dest='+DATA'

*.db_recovery_file_dest='+FRADG'

*.db_recovery_file_dest_size=4560m

*.diagnostic_dest='/ora/app/oracle'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=dbnameXDB)'

*.log_archive_dest_1='location=+FRADG'

*.log_archive_dest_state_1='enable'

*.open_cursors=300

*.processes=300

*.remote_login_passwordfile='EXCLUSIVE'

*.undo_tablespace='UNDOTBS1'
###################################################################################

Step 6:-  Start the instance in non mount mode in target machine

###################################################################################

export ORACLE_HOME=/u01/app/oracle/11.2.0.4/db_1

export PATH=$ORACLE_HOME/bin:$PATH

export ORACLE_SID=dbname

sqlplus / as sysdba

startup nomount pfile='$ORACLE_HOME/dbs/initdbname.ora'

###################################################################################

Step 7:- In target machine, Using RMAN , run duplicate command as below

###################################################################################

rman

connect target sys/password@dbname

connect auxiliary sys/password@dbdup        (must to be dbdup as per your tns entry)

run {

allocate channel c1 device type disk;

allocate auxiliary channel t1 device type disk;

duplicate target database to dbname from active database

pfile=$ORACLE_HOME/dbs/initdbname.ora

logfile

group 1 ('+DATA','+FRADG') SIZE 200M;

group 2 ('+DATA','+FRADG') SIZE 200M;

release channel t1;

The above will create a database in ASM with single instance now you need to make this as RAC instance before upgrading to 12c.

###################################################################################

Step 8:- Convert Database to RAC, In target database run the following`

###################################################################################

alter database add logfile thread 2 group 3 ('+DATA','+FRADG') size 200m reuse;

alter database add logfile thread 2 group 4 ('+DATA','+FRADG') size 200m reuse;

alter database enable public thread 2;

create undo tablespace UNDOTBS2 datafile  '+DATA' size 500M;

###################################################################################

Step 9:- Add the parameters in init file and copy the parameter files to remote nodes as well

###################################################################################
*.cluster_database_instances=2

*.cluster_database=true

dbname1.instance_number=1

dbname2.instance_number=2

dbname1.thread=1

dbname2.thread=2

dbanme1.undo_tablespace='UNDOTBS1'

dbanme2.undo_tablespace='UNDOTBS2'

cd $ORACLE_HOME/dbs

cp initdbname.ora initdbname1.ora

scp initdbname.ora node2:$ORACLE_HOME/dbs/initdbname2.ora

###################################################################################

Step 10: Shut down and compile the binaries with RAC option, this ensures oracle home is enabled with RAC options

###################################################################################

sqlplus / as sysdba

shut immediate

Convert the binaries to RAC

cd $ORACLE_HOME/rdbms/lib

make -f ins_rdbms.mk rac_on

make -f ins_rdbms.mk ioracle

###################################################################################

Step 11: Startup the instance in node 1/db_1

###################################################################################

Change the

export ORACLE_HOME=/u01/app/oracle/11.2.0.4/db_1

export PATH=$ORACLE_HOME/bin:$PATH

export ORACLE_SID=dbname1  --> ensure this is instance name you are starting

sqlplus / as sysdba

startup mount pfile='/u01/app/oracle/11.2.0.4/db_1/initdbname1.ora'

create spfile='+DATA' from pfile;

shut immediate

startup

###################################################################################

Step 12 : Register database with Oracle CRS

###################################################################################
srvctl add database -d dbname -o /u01/app/oracle/11.2.0.4/db_1 -p $ORACLE_HOME/dbs/spfileDBNAME.ora

srvctl add instance -d dbname -i dbname1 -n node1

srvctl add instance -d dbanme -i dbname2 -n node2

###################################################################################

Step 13:- With all above, the database is converted to RAC & ASM, now the remaining part is to upgrade the database to
12c.

###################################################################################

# Stop the database &

srvctl stop database -d dbname

# Copy the password file and spfile to new home

$ cp /u01/app/oracle/11.2.0.4/db_1/dbs/spfiledbname.ora /u01/app/oracle/product/12.1.0.2/db_1/dbs

$ cp /u01/app/oracle/11.2.0.4/db_1/dbs/orapwdbname1 /u01/app/oracle/product/12.1.0.2/db_1/dbs

# Set Oracle HOME and PATH to 12c database home

export ORACLE_HOME=/u01/app/oracle/12.1.0.2/db_1

export PATH=$ORACLE_HOME/bin:$PATH

export ORACLE_SID=dbname1

sqlplus / as sysdba

startup upgrade

cd $ORACLE_HOME/rdbms/admin

$ORACLE_HOME/perl/bin/perl catctl.pl catupgrd.sql

###################################################################################

Step 13: Change the CRS registry for new home

###################################################################################

srvctl modify database -d dbname -o /u01/app/oracle/12.1.0.2/db_1

###################################################################################

Step 14:- Change the environemnt variables and /etc/oratab entries to new home

###################################################################################

You might also like