synchronize & upgrade Oracle standby database after primary database upgrade

This guide will illustrate the required steps to Upgrade & Synchronize physical standby database after upgrading primary oracle database. Note that physical standby is not setup based on “data guard” technology.

In this simulation…i am simulating that primary database was upgraded from Oracle 12cR1 to 12cR2 ( this is still applicable with newer releases).

1. before proceeding with upgrading primary database, put the physical standby database in read-only mode

sqlplus / as sysdba

SQL> shutdown immediate;
SQL> STARTUP NOMOUNT;
SQL> ALTER DATABASE MOUNT STANDBY DATABASE;

SQL> ALTER DATABASE OPEN READ ONLY;

SQL> select OPEN_MODE,DATABASE_ROLE from v$database;

OPEN_MODE DATABASE_ROLE

——————– —————-

READ ONLY PHYSICAL STANDBY

2. upgrade the primary database – please refer Oracle documentation for Oracle database upgrade documentation….also you can reference my own previous articles:

https://geodatamaster.com/2019/06/01/oracle-database-new-auto-upgrade-tool-simulation/

https://geodatamaster.com/2018/08/28/upgrading-oracle-database-from-12cr2-to-18c-in-windows/

https://geodatamaster.com/2017/04/02/upgrading-oracle-database-from-12cr1-to-12cr2-in-windows-environment/

3. After successfully upgrading the primary Oracle database,move the new and patched binries from the “primary” database server to the “standby” database server

mkdir /stdby/orcl/

cd /stdby/orcl/
tar -cf oraInventory.tar -P $ORACLE_BASE/product/oraInventory

tar -cf 12cR2.tar -P $ORACLE_BASE/product/12.2

4. go to the database standby server

**** shutdown standby database

sqlplus / as sysdba

SQL> shutdown immediate;

*** update your user profile to point to the new binaries
cd

vi .profile

%s/12.1/12.2/g
*** rename old database binaries

cd /app/orcl/product

mv 12.1 12.1.old

*** refresh your user profile exit the shell and enter again

echo $ORACLE_HOME
*** untar the new binaries

cd /app/orcl/product

tar -xf /stdby/orcl/oraInventory.tar -P
tar -xf /stdby/orcl/12cR2.tar -P
*** startup the standby database in standby mode:

SQL> STARTUP NOMOUNT;

SQL> ALTER DATABASE MOUNT STANDBY DATABASE;

SQL> RECOVER AUTOMATIC STANDBY DATABASE;

SQL> select open_mode,database_role from v$database;
*** Remark: keep applying the logs and monitor standby database alert log file