Oracle Multitenant Architecture
Oracle

Patching Process of Pluggable Databases (Part 1)

May 25, 2019

(One stand-alone DB server with a CDB and multiple PDBs)

In this article you may find some instructions regarding the Patching Process of Oracle Pluggable Databases on a stand-alone DB Server with one Container Database (CDB) and multiple Pluggable Databases.

The reason why I am referring to stand-alone DB Server, is that the process is slightly different when it comes to a e.g. 2-node RAC. You will find more details at Patching Process of Pluggable Databases (Part 2).

The steps that you need to follow in order to apply the latest PSU are the following:

  1. Source the environment of the CDB.
       $ . oraenv

  2. Upgrade OPatch utility to the latest version.

  3. Download and unzip the latest COMBO PSU.

  4. Check for possible conflicts between the downloaded PSU and the already applied patches
       $ ./opatch prereq CheckConflictAgainstOHWithDetail -ph ./

  5. In order to find the PDBs that are connected to this CDB along with their status, we execute the following command:
    SQL> column name format a15  
    COLUMN "RESTRICTED" FORMAT A10  
    select d.con_id, v.name, v.open_mode, nvl(v.restricted, 'n/a') "RESTRICTED", d.status   from v$PDBs v inner join dba_pdbs d using (GUID) order by v.create_scn;

  6. Close all the PDBs that are related to this CDB with the following command:
       SQL> alter pluggable database all close immediate;

  7. Shutdown the CDB
       SQL> shutdown immediate

  8. Stop the listener
       $ lsnrctl stop

  9. Go to OPatch path
       $ cd $ORACLE_HOME/OPatch

  10. Apply the combo DB + OJVM Patch (with the usual way)
       $ ./opatch napply <PATCH_LOCATION>/<PATCH_NUMBER>

  11. Start the listener
       $ lsnrctl start

  12. Start the CDB
       SQL> startup

  13. Open all the PDBs
       SQL> alter pluggable database all open;

  14. Staying at OPatch path, we execute the following command:
       $ ./datapatch -verbose

  15. If everything has succeeded (e.g.we see the following in the datapatch log: Patch 28729169 apply (pdb TESTPDB): SUCCESS), we proceed with the restart of the CDB and we open all the PDBs
       SQL> shutdown immediate
       SQL> startup
       SQL> alter pluggable database all open;

  16. Verify that the patches have been applied to the CDB
       $ ./opatch lspatches

  17. Verify that the patches have been applied to the PDBs by executing the following commands:
       $ sqlplus / as sysdba
    SQL> alter session set container=<PDB_NAME>;  
    SQL>
    col action_time for a28  

    col action for a8  
    col version for a8  
    col status for a8  
    col comments for a30  
    set line 999 pages 999  
    select con_id, patch_id, version, status, Action, Action_time from cdb_registry_sqlpatch order by action_time;  
    select patch_id, patch_uid, version, status, description from cdb_registry_sqlpatch;  
    select patch_id, version, status, Action, Action_time from cdb_registry_sqlpatch order by action_time;


We are ready 🙂

P.S. Of course, there are other ways to proceed with the patching with minimum downtime (e.g. by unplugging the PDB from its original container and plugging it into another CDB that has the newest PSU already applied). We will examine this way in another post.

Only registered users can comment.

Leave a Reply

Your email address will not be published. Required fields are marked *