I have already explained in broad details a while ago how to:
- Upgrade a Multitenant Environment – Everything at Once
https://mikedietrichde.com/2014/08/06/upgrade-pdbs-everything-at-once-full-cdb-upgrade/ - Upgrade in a Single-/Multitenant Environment – One/Many at a time
or also known as unplug/plug/upgrade strategy
https://mikedietrichde.com/2014/08/05/upgrade-pdbs-one-at-a-time-unplugplug/
But one may miss the steps for applying a PSU (Patch Set Update) or BP (Bundled Patch) to a Single-/Multitenant Environment.
At first everything will work just the same if you choose the Everything-at-Once strategy as datapatch will adjust all the required things regardless of being executed in a stand-alone or a singe/Multitenant environment.
But what happens if you apply a PSU or a BP to one of your Multitenant environments and want to move PDBs one after another (or a few at the same time) to the new environment?
Or revert a PSU by plugging out from a CDB with the PSU inside – and plug it back into a CDB with a lower version or no PSU at all?
First step – Check Plug In Compatibility
Before you can even start your unplug/plug operation you should always perform the plugin check. This is divided in two simple steps:
- Create the XML description file for your PDB in CDB_SOURCE
exec DBMS_PDB.DESCRIBE ('/home/oracle/PDB1_unplug.xml', 'PDB1');
- Run the plug in check in CDB_DEST
begin if DBMS_PDB.CHECK_PLUG_COMPATIBILITY('/home/oracle/PDB1_unplug.xml','PDB1') then DBMS_OUTPUT.PUT_LINE('No violations found - you can relax'); else DBMS_OUTPUT.PUT_LINE('Violations found - check PDB_PLUG_IN_VIOLATIONS'); end if; end; /
No Plugin Violations?
Then please follow the procedure described in:
https://mikedietrichde.com/2014/08/05/upgrade-pdbs-one-at-a-time-unplugplug/
without the upgrade part as you don’t need to upgrade anything in this case of course.
Higher patch in CDB_DEST than in CDB_SOURCE?
Then run this query:
select TYPE,MESSAGE,ACTION from PDB_PLUG_IN_VIOLATIONS where NAME='PDB1';
It will tell you to execute datapatch:
TYPE MESSAGE ------ ---------------------------------------------------------------------------- ERROR PSU bundle patch 1 (PSU Patch 4711): Installed in the CDB but not in the PDB ACTION ------------------------------------------------ Call datapatch to install in the PDB or the CDB
Lower patch in CDB_DEST than in CDB_SOURCE?
Now this becomes a bit more tricky. See the output of PDB_PLUG_IN_VIOLATIONS:
TYPE MESSAGE ----- ---------------------------------------------------------------------------- ERROR PSU bundle patch 1 (PSU Patch 4711): Installed in the PDB but not in the CDB ACTION ------------------------------------------------ Call datapatch to install in the PDB or the CDB
Huh? Install???
What does this mean? Should I install now the current CDB/PDB’s PSU into my target environment before being able to step down?
Actually I think this message is misleading. And when you look into the MyOracle Support Note describing this under scenario 3 (MOS Note:1935365.1 – Multitenant Unplug/Plug Best Practices) you’ll see that the author silently assumed as well that is is more likely that you’ll remove the patch from the PDB.
But how do you remove changes which came in with datapatch from within a PDB only?
You will need to run datapatch -rollback on the affected PDBs only:
$> datapatch -rollback <patch id> –force [–bundle_series] -pdbs <pdb1,pdb2,...,pdbn>
For further information see:
- MOS Note:1935365.1
Multitenant Unplug/Plug Best Practices - MOS Note 1635482.1
After running datapatch, PDB plugin or cloned db returns violations shown in PDB_PLUG_IN_VIOLATION - MOS Note:1609718.1
Datapatch Known Issues on datapatch
–Mike