Oracle 11g to 12c Upgrade With Data Guard & ASM

In this article we will be performing Oracle 11g to 12c database upgrade with data guard and ASM configured.

Below are the steps we are going to follow to perform the database upgrade:

  • Upgrade GRID_HOME on standby
  • Upgrade ORACLE_HOME on standby
  • Upgrade GRID_HOME on primary
  • Upgrade ORACLE_HOME on primary
  • Post upgrade steps

Let us start the upgrade process.

Upgrade GRID_HOME on Standby

DISABLE DG BROKER (only on primary)

  1. Disable fast-start failover: As part of upgrade, you must disable DG Broker. Disable fast-start failover if it is enabled
DGMGRL> DISABLE FAST_START FAILOVER;

2. Disable DG BROKER configuration

DGMGRL> DISABLE CONFIGURATION;

3. Disable DG BROKER START via sqlplus

SQL> ALTER SYSTEM SET DG_BROKER_START=FALSE;

4. Take backup of broker configuration files: At this stage, it’s good to take backup of dg broker configuration files.

SQL> show parameter dg_broker_config_file;
>> Make a copy of broker configuration files into some backup location /u01 or /u02

ON STANDBY

  1. Stop MRP or Log Apply Services: We must stop MRP. Note, we are not stopping log shipping from primary. Log shipping will continue.
SQL> alter database recover managed standby database cancel;
SQL> shutdown immediate;

2. Disable oracle restart (srvctl): We must remove database from srvctl utility as it might auto restart database during upgrade process which we do not want. Once upgrade is done, we will re-register database with 12c srvctl utility

As Oracle user:
===============
cd /u01/app/11.2.0/grid/bin
./srvctl remove database -d proddb

Start Standby with MRP:
=======================
sqlplus / as sysdba
SQL> startup mount;
SQL> alter database recover managed standby database disconnect;

3. Download and upgrade oracle 12c grid software (as grid user): We will now download and upgrade oracle 12c grid software in a new grid home location. Note, you cannot have two grid softwares on a server. Hence, you can only upgrade any previous version of grid.

4. Unzip linux 12c grid software

unzip linuxamd64_12c_grid_1of2.zip 
unzip linuxamd64_12c_grid_2of2.zip

5. Start the run installer

cd /u02/grid
./runInstaller

Follow the below screens to upgrade the grid software

Once the installation is done, you need to proceed with post grid upgrade steps below.

POST GRID UPGRADE STEPS (on standby)

  1. Change grid environment variables: Change ORACLE_HOME location under grid user .bash_profile
# su - grid
# vi .bash_profile
# . .bash_profile			>> execute bash profile

# env|grep ORA
ORACLE_SID=+ASM
ORACLE_BASE=/u01/app/grid
ORACLE_TERM=xterm
ORACLE_HOME=/u01/app/12.1.0/grid		>> this must point to new grid home

Upgrade ORACLE_HOME on Standby

Note: In any grid environment, first we have to upgrade the grid software and then the database software. The grid software can be of same or higher release than the database.

  1. Unzip the database software as oracle user on standby: switch to oracle user and unzip the database software.
su - oracle
cd /u02
unzip linuxamd64_12c_database_1of2.zip
unzip linuxamd64_12c_database_2of2.zip

2. Start the run installer and install oracle 12c database software on standby: Now its time to install oracle 12c in a new home.

cd /u02/database
./runInstaller

3. Shutdownstandby database if running from old home: Shutdown the database which is running via old oracle 11g home.

sqlplus / as sysdba
shut immediate;

4. Copy tnsnames.ora to new home: From the old oracle 11g home, copy the tnsnames.ora file to new 12c ORACLE_HOME/network/admin location

cd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/
cptnsnames.ora /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/

5. Copy parameter file and password file to new home: From the old 11g home, copy the pfile and password file to new 12c ORACLE_HOME/dbs location

cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs
cpinitproddb_st.ora /u01/app/oracle/product/12.1.0/dbhome_1/dbs
cporapwproddb_st /u01/app/oracle/product/12.1.0/dbhome_1/dbs

6. Modify oratab to reflect new oracle home: Update old Oracle Home with 12c oracle home in /etc/oratab file on standby.

7. Modify oracle user environment variables: Update oracle user bash profile to point new 12c oracle home

cd 
vi .bash_profile
. .bash_profile

env|grep ORA
ORACLE_UNQNAME=proddb_st
ORACLE_SID=proddb_st
ORACLE_BASE=/u01/app/oracle
ORACLE_TERM=xterm
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1

8. Mount the standby via 12c home: Now that bash profile is pointing to 12c home, mount the standby database and start MRP apply.

sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Thu Apr 27 17:30:54 2017

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL>startup mount;
ORACLE instance started.

Total System Global Area 1269366784 bytes
Fixed Size                  2287912 bytes
Variable Size             855639768 bytes
Database Buffers          402653184 bytes
Redo Buffers                8785920 bytes
Database mounted.

SQL>select name, open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
proddb     MOUNTED

SQL> alter database recover managed standby database disconnect;>>start MRP

9. Update new oracle home in listener

su - grid
cd $ORACLE_HOME/network/admin
vi listener.ora				>> edit new oracle home

lsnrctl stop listener
lsnrctl start listener

10. Register with oracle 12c restart (srvctl): We need to register standby database with srvctl utility as it will help us manage database easly.

On standby:
===========
sqlplus / as sysdba
SQL>alter database recover managed standby database cancel;
SQL>shutdown immediate
SQL> exit;

switch to grid home location via oracle user:
=============================================
OS> cd /u01/app/12.1.0/grid/bin

OS>./srvctl add database -d proddb -iproddb_st -o /u01/app/oracle/product/12.1.0/dbhome_1 -r PHYSICAL_STANDBY -s MOUNT

OS>./srvctl start database -d proddb
OS>./srvctl status database -d proddb

Start MRP:
==========
sqlplus / as sysdba
SQL>alter database recover managed standby database disconnect;

Note: even though we can start stop standby database via srvctl utility, we must always start MRP manually.

Upgrade GRID_HOME on Primary

  1. Disable oracle restart (srvctl) on primary: The srvctl utility will auto restart our database which we do not want during the upgrade.
su - oracle
cd /u01/app/11.2.0/grid/bin

# ./srvctl config database -d proddb		>> save the output
Database unique name: proddb
Database name: proddb
Oracle home: /u01/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/proddb/spfileproddb.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Database instance: proddb
Disk Groups: DATA,FRA
Services:

./srvctl stop database -d proddb	>> Downtime starts
./srvctl remove database -d proddb

2. Increase RAM and start DB manually: In your practice, you might have assigned less RAM. For upgrade, you must have 4 GB allocated both on primary and standby.

  • Make sure primary has 4 GB RAM, if not, stop the virtual machine, increase RAM and then start it up.
  • Once machine is up, start DB manually

3. Download and upgrade oracle 12c grid software (as grid user): We will now download and upgrade oracle 12c grid software in a new grid home location. Note, you cannot install two grid software on a server. Hence, you can only upgrade any previous version of grid.

4. Unzip linux 12c grid software

unzip linuxamd64_12c_grid_1of2.zip 
unzip linuxamd64_12c_grid_2of2.zip

5. Start the run installer

cd /u02/grid
./runInstaller

Follow the below screens to upgrade the grid software

Once the installation is done, you need to proceed with post grid upgrade steps below.

POST GRID UPGRADE STEPS (on primary)

  1. Change grid environment variables: Change ORACLE_HOME location under grid user .bash_profile
# su - grid
# vi .bash_profile
# . .bash_profile			>> execute bash profile

# env|grep ORA
ORACLE_SID=+ASM
ORACLE_BASE=/u01/app/grid
ORACLE_TERM=xterm
ORACLE_HOME=/u01/app/12.1.0/grid		>> this must point to new grid home

Upgrade ORACLE_HOME on Primary

Note: In any grid environment, first we have to upgrade the grid software and then the database software. The grid software can be of same or higher release than the database.

  1. Unzip the database software as oracle user on primary: switch to oracle user and unzip the database software.
su - oracle
cd /u02
unzip linuxamd64_12c_database_1of2.zip
unzip linuxamd64_12c_database_2of2.zip

2. Start the run installer and install oracle 12c database software on standby: Now it’s time to install oracle 12c in a new home.

cd /u02/database
./runInstaller

3. Make sure DB is up and running at this stage

4. Copy tnsnames.ora to new home: From the old oracle 11g home, copy the tnsnames.ora file to new 12c ORACLE_HOME/network/admin location

cd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/
cptnsnames.ora /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/

5. Modify oracle user environment variables: Update oracle user bash profile to point new 12c oracle home

cd 
vi .bash_profile
. .bash_profile

env|grep ORA
ORACLE_UNQNAME=proddb_st
ORACLE_SID=proddb_st
ORACLE_BASE=/u01/app/oracle
ORACLE_TERM=xterm
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1

6. Update new oracle home in listener: We must also update the listener file to point new 12c home location as grid user.

su - grid
cd $ORACLE_HOME/network/admin
vi listener.ora

lsnrctl stop listener
lsnrctl start listener

7. Start DBUA: Let us upgrade the 11g database to 12c. Make sure DB is still up and running via 11g home

Follow the screens and upgrade the database.

Post Upgrade Steps

  • Check /etc/oratab file
  • Check dbs location for parameter & password file
  • Check DR is in sync with prod
  • Perform Prim – stb bounce
  • Add database to Oracle restart or SRVCTL on primary
  • Enable DG Broker
  • Remove 11g grid and oracle home from both systems
  • Update compatibility parameter (requires db bounce and must be performed after 30 days of the upgrade)

Was this article helpful?

Related Articles

Leave a Comment