The example below shows how to patch a Pluggable Database (PDB) migrated to a Container Database (CDB) whith a different patch level.
List the PDB violations
col message for a150 col action for a60 select * FROM pdb_plug_in_violations WHERE STATUS <>'RESOLVED'; TIME NAME CAUSE TYPE ERROR_NUMBER LINE --------------------------------------------------------------------------- ------------------------------ ---------------------------------------------------------------- --------- ------------ ---------- MESSAGE STATUS ACTION ------------------------------------------------------------------------------------------------------------------------------------------------------ --------- ------------------------------------------------------------ 15-07-16 11:33:26.022539 CUSPPO SQL Patch ERROR 0 1 PSU bundle patch 160419 (Database Patch Set Update : 12.1.0.2.160419 (22291127)): Installed in the CDB but not in the PDB. ERROR Call datapatch to install in the PDB or the CDB 1 row selected.
Datapatch help
[oracle@zlo6ka1n1 OPatch]$ ./datapatch -h SQL Patching tool version 12.1.0.2.0 on Wed Jun 15 10:53:36 2016 Copyright (c) 2015, Oracle. All rights reserved. sqlpatch usage: All arguments are optional, if there are no arguments sqlpatch will automatically determine which SQL scripts need to be run in order to complete the installation of any SQL patches. Optional arguments: -db <db name> Use the specified database rather than $ORACLE_SID -bundle_series <bundle_series> Specify if the patch is a bundle patch Should also be accompanied by -force option if -bundle_series option is specified,only 1 patch will be considered by the -force command -apply <patch1,patch2,...,patchn> Only consider the specified patch list for apply operations -rollback <patch1,patch2,...,patchn> Only consider the specified patch list for rollback operations -upgrade_mode_only Only consider patches that require upgrade mode -force Run the apply and/or rollback scripts even if not necessary per the SQL registry -pdbs <pdb1,pdb2,...,pdbn> Only consider the specified list of PDBs for patching. All other PDBs will not be patched -prereq Run prerequisite checks only, do not actually run any scripts -oh <oracle_home value> Use the specified directory to check for installed patches -verbose Output additional information used for debugging -help Output usage information and exit -version Output build information and exit SQL Patching tool complete on Wed Jul 15 10:53:36 2016
Apply the patch to the PDB
[oracle@zlo6ka1n0 OPatch]$ ./datapatch -verbose SQL Patching tool version 12.1.0.2.0 on Wed Jul 15 11:36:19 2016 Copyright (c) 2015, Oracle. All rights reserved. Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_59195_2016_07_15_11_36_19/sqlpatch_invocation.log Connecting to database...OK Note: Datapatch will only apply or rollback SQL fixes for PDBs that are in an open state, no patches will be applied to closed PDBs. Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation (Doc ID 1585822.1) Bootstrapping registry and package to current versions...done Determining current state...done Current state of SQL patches: Bundle series PSU: ID 160419 in the binary registry and ID 160419 in PDB CDB$ROOT, ID 160419 in PDB PDB$SEED Adding patches to installation queue and performing prereq checks... Installation queue: For the following PDBs: CDB$ROOT PDB$SEED Nothing to roll back Nothing to apply For the following PDBs: CUSPPO Nothing to roll back The following patches will be applied: 22291127 (Database Patch Set Update : 12.1.0.2.160419 (22291127)) Installing patches... Patch installation complete. Total patches installed: 1 Validating logfiles... Patch 22291127 apply (pdb CUSPPO): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/22291127/19694308/22291127_apply_CLGBTE_CUSPPO_2016Jul15_11_37_25.log (no errors) SQL Patching tool complete on Wed Jul 15 11:37:36 2016 [oracle@zlo6ka1n0 OPatch]$