Database Upgrade with Standby on ODA

A couple of days ago I did my easiest upgrade of an Oracle Database ever. This is the system:

  • 2 Oracle Database Appliances in two locations
  • Databases running as single instance due to licensing restrictions
  • DataGuard between ODA-1 and ODA-2 for mission-critical databases
  • several databases, version and
  • currently running ODA, so big excuse for not being up-to-date

The customer wanted me to upgrade one of these databases to So the basic steps are as follows:

  1. Install new Oracle Home for version
  2. Disable DataGuard configuration
  3. Stop DataGuard Broker processes
  4. Stop Standby database
  5. Upgrade Primary database
  6. Start Standby database from new home

On an ODA this is quite simple to do. First create a new Oracle Home an both ODAs:

root$ oakcli create dbhome -version
INFO: 2016-03-15 09:25:07: Installing a new Home : OraDb12102_home3 at /u01/app/oracle/product/
SUCCESS: 2016-03-15 09:30:55: Successfully created the Database Home : OraDb12102_home3

Now there is the new 12c home that we can use for the upgrade. One could also use an existing home that can be chosen from the list:

root$ oakcli show dbhomes -detail

Next step is disabling the DataGuard configuration:

oracle$ . oraenv
oracle$ dgmgrl
DGMGRL> connect sys/****@primary
DGMGRL> disable configuration

Now stop the DataGuard Broker processes on both, primary and standby:

oracle$ . oraenv
oracle$ sqlplus / as sysdba
SQL> alter system set dg_broker_start=false scope=both;

System altered.

Stop the Standby database:

oracle$ srvctl stop database -d <dbname>

And now do the upgrade of the Primary to the Oracle Home that was created or chosen in the first step. It will ask for the SYS password, be prepared for that.

root$ oakcli upgrade database -db <dbname> -to OraDb12102_home3
INFO: 2016-03-15 10:30:30: Look at the log file '/opt/oracle/oak/log/<odabase-01>/tools/' for more details 

Please enter the 'SYS'  password : 
Please-enter the 'SYS' password: 
2016-03-15 10:31:29: Upgrading the database <dbname>. It will take few minutes. Please wait... 

 SUCCESS: 2016-03-15 10:50:01: Successfully upgraded the database <dbname>

That’s it for the Primary. Now modify the Standby to use the new 12c Database Home. Copy the password file to the new Oracle Home, and, if it is not in a shared location, the SPfile too.

oracle$ cp <old ORACLE_HOME>/dbs/orapw<dbname> <new ORACLE_HOME>/dbs/ 
oracle$ cp <old ORACLE_HOME>/dbs/spfile<dbname>.ora <new ORACLE_HOME>/dbs/

The database resource needs to be modified in order to use the new Oracle Home. That is the last time that “srvctl” is run from the old Oracle Home:

oracle$ srvctl config database -d <dbname> 
oracle$ srvctl modify database -d <dbname> -o /u01/app/oracle/product/

If required, change the SPfile location too:

oracle$ srvctl modify database -d <dbname> -p /u01/app/oracle/product/<dbname>.ora

Now the Standby can be started again:

oracle$ srvctl start database -d <dbname>

Last step is to start the DataGuard Broker processes and re-enable the configuration.

oracle$ . oraenv
oracle$ sqlplus / as sysdba
SQL> alter system set dg_broker_start=true scope=both;

System altered.
oracle$ . oraenv
oracle$ dgmgrl
DGMGRL> connect sys/****@primary
DGMGRL> enable configuration

Very simple and very straight forward. I like ODA 🙂

There is some documentation that has been used: