• Arun Kumar

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

Note: In a dataguard setup, you always update the standby first and then the primary database.


Upgrade GRID_HOME on Standby


We will first upgrade GRID_HOME on standby and later update the ORACLE_HOME.


Primary DB Changes


Disable DG Broker: As part of upgrade, you must disable DG Broker. Disable fast-start failover if it is enabled

DGMGRL> DISABLE FAST_START FAILOVER;
DGMGRL> DISABLE CONFIGURATION;

Disable DG BROKER START via sqlplus

SQL> ALTER SYSTEM SET DG_BROKER_START=FALSE;

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

Standby DB Changes


Stop MRP on the standby server

SQL> alter database recover managed standby database cancel;
SQL> shutdown immediate;
Note: We are not stopping log shipping from primary. Log shipping will continue

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;

Upgrade GRID_HOME


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.

oracle 11g to 12c upgrade with data guard & asm - download grid software
Note: you cannot have two grid software installation on a server. You can only upgrade any previous version of grid.

Unzip linux 12c grid software

unzip linuxamd64_12c_grid_1of2.zip 
unzip linuxamd64_12c_grid_2of2.zip

Start the run installer

cd /u02/grid
./runInstaller

Follow the below screens to upgrade the grid software

oracle grid infrastructure - skip software updates
oracle grid infrastructure  - upgrade oracle grid infrastructure or oracle automatic storage management
oracle grid infrastructure - product language
oracle grid infrastructure - operating system groups
oracle grid infrastructure - osasm group
oracle grid infrastructure  - software installation location
oracle grid infrastructure - software location warning
oracle grid infrastructure - root script execution configuration
oracle grid infrastructure  - perform prerequisite checks
oracle grid infrastructure  - prerequisites check physical memory error
oracle grid infrastructure - prerequisite check warning
oracle grid infrastructure - grid upgrade summary
oracle grid infrastructure - install grid product

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


Post GRID Upgrade Steps


Change ORACLE_HOME location to new grid installation under GRID user bash_profile

su - grid
vi .bash_profile

--> update ORACLE_HOME to reflect new grid software location

env|grep ORA

ORACLE_SID=+ASM
ORACLE_BASE=/u01/app/grid
ORACLE_TERM=xterm
ORACLE_HOME=/u01/app/12.1.0/grid    --> must point to new grid home


Upgrade ORACLE_HOME on Standby


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.


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

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
oracle database 12c release 1 installer - configure security updates
oracle database 12c release 1 installer - skip software updates
oracle database 12c release 1 installer - install database software only
oracle database 12c release 1 installer - single instance database installation
oracle database 12c release 1 installer - product language
oracle database 12c release 1 installer - enterprise edition
oracle database 12c release 1 installer - software installation location
oracle database 12c release 1 installer - privileged operating system groups
oracle database 12c release 1 installer - prerequisite checks
oracle database 12c release 1 installer - summary
oracle database 12c release 1 installer - install product
oracle database 12c release 1 installer - installing database successful

Shutdown standby database if running from old home: Shutdown the database which is running via old oracle 11g home

sqlplus / as sysdba
shut immediate;

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/

cp tnsnames.ora /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/

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

cp initproddb_st.ora /u01/app/oracle/product/12.1.0/dbhome_1/dbs
cp orapwproddb_st /u01/app/oracle/product/12.1.0/dbhome_1/dbs

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


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

cd 
vi .bash_profile

--> update ORACLE_HOME to new 12c home location

. .bash_profile

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> 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;

Update new oracle home under listener.ora file

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

lsnrctl stop listener
lsnrctl start listener

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

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:
=============================================
cd /u01/app/12.1.0/grid/bin

./srvctl add database -d proddb -i proddb_st -o /u01/app/oracle/product/12.1.0/dbhome_1 -r PHYSICAL_STANDBY -s MOUNT

./srvctl start database -d proddb
./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


Now its time to upgrade GRID_HOME on primary and later we will upgrade ORACLE_HOME.


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

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.

upgrade grid on primary - download oracle 12c grid software
Note: you cannot install two grid software on a server. Hence, you can only upgrade any previous version of grid.

As grid user, unzip linux 12c grid software

unzip linuxamd64_12c_grid_1of2.zip 
unzip linuxamd64_12c_grid_2of2.zip

Start the run installer

cd /u02/grid
./runInstaller

Follow the below screens to upgrade the grid software

oracle grid infrastructure - skip software updates
oracle grid infrastructure - upgrade oracle grid infrastructure
oracle grid infrastructure - select product language
oracle grid infrastructure - operating system groups
oracle grid infrastructure - osasm group
oracle grid infrastructure - oracle base
oracle grid infrastructure - oracle home outside of oracle base
oracle grid infrastructure - root script execution configuration
oracle grid infrastructure - prerequisite checks
oracle grid infrastructure - perform prerequisite checks
oracle grid infrastructure - prerequisite
oracle grid infrastructure - summary
oracle grid infrastructure - install product
oracle grid infrastructure - oracle grid infrastructure

Post Grid Upgrade Steps


Change ORACLE_HOME location to new grid installation under GRID user bash_profile

vi .bash_profile

--> update ORACLE_HOME to reflect newgrid software location

env|grep ORA

ORACLE_SID=+ASM
ORACLE_BASE=/u01/app/grid
ORACLE_TERM=xterm
ORACLE_HOME=/u01/app/12.1.0/grid	--> must point to new grid home


Upgrade ORACLE_HOME on Primary


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.


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

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
oracle database 12c release 1 installer - configure security updates
oracle database 12c release 1 installer - skip software updates
oracle database 12c release 1 installer - install database software
oracle database 12c release 1 installer - grid installation
oracle database 12c release 1 installer - select product language
oracle database 12c release 1 installer - database edition
oracle database 12c release 1 installer - software location
oracle database 12c release 1 installer - privileged operating system groups
oracle database 12c release 1 installer - prerequisite checks
oracle database 12c release 1 installer - summary
oracle database 12c release 1 installer - install product
oracle database 12c release 1 installer - oracle database installation

Start the database from old ORACLE_HOME location

SQL> startup;

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/

cp tnsnames.ora /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/

Modify oracle user environment variables: Update oracle user .bash_profile to point new 12c oracle home

cd 
vi .bash_profile

--> update ORACLE_HOME to new 12c location

env|grep ORA

ORACLE_UNQNAME=proddb
ORACLE_SID=proddb
ORACLE_BASE=/u01/app/oracle
ORACLE_TERM=xterm
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1

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

--> update ORACLE_HOME to new 12c location

lsnrctl stop listener
lsnrctl start listener

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

database upgrade assistant - upgrade oracle database
database upgrade assistant - select database
database upgrade assistant - prerequisite checks
database upgrade assistant - upgrade options
database upgrade assistant - configure enterprise manager em database express
dbua - move database files
database upgrade assistant - network configuration listener selection
database upgrade assistant - recovery options
database upgrade assistant - database upgrade summary
database upgrade assistant - database upgrade components

Done! Both Primary and Standby are upgraded!



Post Upgrade Steps


  • Check /etc/oratab file

  • Check dbs location for parameter & password file

  • Check DR is in sync with prod

  • Perform Primary, standby 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)

1,939 views

Recent Posts

See All