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 126.96.36.199 and 188.8.131.52
- currently running ODA 184.108.40.206, so big excuse for not being up-to-date
The customer wanted me to upgrade one of these 220.127.116.11 databases to 18.104.22.168. So the basic steps are as follows:
- Install new Oracle Home for version 22.214.171.124
- Disable DataGuard configuration
- Stop DataGuard Broker processes
- Stop Standby database
- Upgrade Primary database
- 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 126.96.36.199.3 ... INFO: 2016-03-15 09:25:07: Installing a new Home : OraDb12102_home3 at /u01/app/oracle/product/188.8.131.52/dbhome_3 ... 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 Connected. DGMGRL> disable configuration Disabled.
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/184.108.40.206.0/dbupgrade_2585.log' 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/220.127.116.11/dbhome_3
If required, change the SPfile location too:
oracle$ srvctl modify database -d <dbname> -p /u01/app/oracle/product/18.104.22.168/dbhome_3/dbs/spfile<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 Connected. DGMGRL> enable configuration Enabled.
Very simple and very straight forward. I like ODA 🙂
There is some documentation that has been used:
- Data Guard Broker – Oracle Data Guard Broker Upgrading and Downgrading
- Data Guard Concecpts and Administration – Upgrading and Downgrading Databases in an Oracle Data Guard Configuration
- Database Appliance Administration and Reference Guide – UManaging Oracle Database on Oracle Database Appliance