Oracle 12c introduced streamlined and simplified method to perform database rolling upgrades. It can be implemented using DBMS_ROLLING PL/SQL package which allows DBA to upgrade or patch databases in DataGuard environment in rolling fashion.This feature require Oracle Active DataGuard license.
The pre-12c (&12c) rolling upgrade method using SQL Apply (Logical Standby) is still an alternate option and there is no licensing cost using SQL Apply to perform rolling upgrades.
It's a 3-stage process to perform rolling upgrades using DBMS_ROLLING PL/SQL package.
- Specify how the rolling upgrade needs to be implemented. Conceptually assigning trailing groups and leading groups. i.e. using DBMS_ROLLING.INIT_PLAN and DBMS_ROLLING.SET_PARAMETER.
- Compile the plan using DBMS_ROLLING.BUILD_PLAN.
- Executing Rolling Upgrade.
Following example outlines the steps for performing PSU patch apply in rolling fashion in DataGuard Physical Standby environment:
- Make sure that there are no UNSUNPPORTED DATATYPES. Check if the unsupported objects are supported by EXTENDED DATATYPE SUPPORT. And, enable EDS accordingly.
- SELECT * FROM DBA_LOGSTDBY_UNSUPPORTED;
- SELECT * FROM DBA_LOGSTDBY_EDS_SUPPORTED;
- EXECUTE DBMS_LOGSTDBY.EDS_ADD_TABLE(schema, table);
- Disable Broker Configuration from DGMGRL Cli.
- Initiaize the rolling upgrade plan.
- exec DBMS_ROLLING.INIT_PLAN(future_primary=>'<physical standby node>');
- select scope, name, curval from dba_rolling_parameters order by scope, name;
- exec DBMS_ROLLING.SET_PARAMETER('SWITCH_LGM_LAG_WAIT', '1');
- exec DBMS_ROLLING.SET_PARAMETER('SWITCH_LGM_LAG_TIME', '60');
- Compile the Plan.
- exec DBMS_ROLLING.BUILD_PLAN;
- SELECT instid, target, phase, description FROM DBA_ROLLING_PLAN;
- Execute the plan.
- Convert Physical Standby to Logical. This step executes the rolling upgrade plan and converts physical standby to logical.
- EXECUTE DBMS_ROLLING.START_PLAN;
- Make sure the logical standby is in sync with primary and shutdown the logical standby and the corresponding listener process.
- Apply PSU on Logical Standby Oracle Home.
- Restart the listener and logical standby database.
- Make sure the logical standby is in sync with primary.
- Perform Switchover. This will perform role-transition, Logical Standby will become PRIMARY.
- EXECUTE DBMS_ROLLING.SWITCHOVER;
- Shutdown former Primary, listener and Apply PSU.
- Startup the listener, former Primary in MOUNT mode.
- Call the DBMS_ROLLING.FINISH_PLAN to convert former primary to physical standby.
- EXECUTE DBMS_ROLLING.FINISH_PLAN;
- Convert Physical Standby to Logical. This step executes the rolling upgrade plan and converts physical standby to logical.
I have recorded a sample demo video performing Patch rollout in rolling fashion using dbms_rolling to provide database service continuity.
demo part 1
demo part 1
demo part 2
Please see Oracle Documentation for complete details.