Enable flashback database

Create a guaranteed restore point,
CREATE RESTORE POINT pre_upgrade GUARANTEE FLASHBACK DATABASE;

Create a physical standby control file,
ALTER DATABASE CREATE PHYSICLA STANDBY CONTROLFILE AS ‘/tmp/ctl.phys’ REUSE;

Convert the physical standby to a logical standby
ALTER DATABASE RECOVER TO LOGICAL STANDBY KEEP IDENTITY;
Disable automatic deletion of foreign archived logs
EXECUTE DBMS_LOGSTDBY.APPLY_SET(‘LOG_AUTO_DELETE’,’FALSE’);
Start SQL apply
ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;

Upgrade the logical standby as described in steps 1 to 6 in the note “rolling upgrade with a logical standby”
After these steps the original primary db will be the logical standby and the original physical standby will be the primary db with upgraded oracle software.

Flash back the original primary db to the guaranteed restore point
SHUTDOWN IMMEDIATE
STARTUP MOUNT
FLASHBACK DATABASE TO RESTORE POINT pre_upgrade;

Restore the standby controlfile on the original primary database.
SHUTDOWN IMMEDIATE
RESTORE CONTROLFILE FROM ‘/tmp/ctl.phys’;
SHUTDOWN

Switch the oracle db binary for the original primary db to use the higher version of the software.
The db_upgrade scripts are not required as this is a standby.
ALTER DATABASE MOUNT
Switch logs on the primary and ensure they are registered at the standby.
Start managed recovery
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;

Perform a switchover
Primary:
ALTER DATABASE COMMIT TPO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
Standby:
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
SHUTDOWN IMMEDIATE;
STARTUP

Start the original primary db as a physical standby