Step to step guide on applying patches on Oracle 19C DB
Step to step guide on applying patches on Oracle 19C DB
Oracle releases patches quarterly, known as Critical Patch Updates (CPU), addressing security
vulnerabilities across its products. Oracle strongly recommends applying the latest patches to
safeguard databases.
Using supported software versions with up-to-date patches ensures continuous support from
Oracle, enhancing both security and performance.
NOTE: Patching is resource-intensive. Ensure you allocate enough CPU and memory. Keep in mind
that patching time depends more on available resources than on the number or size of databases.
Page | 1
[oracle@oracle OPatch]$ ./opatch version
The patch ID 29517242 was successfully applied to the root container on 2023-09-11. We can also
query the pluggable databases (PDBs) to confirm the patch status by switching to each PDB.
The DBA_REGISTRY view provides information about all components loaded into the component
registry. This registry tracks the status and version of each component in the database.
Page | 2
It is important to identify and fix any invalid object before patching. To identify invalid object,
query the dba_objects.
SQL> COLUMN object_name FORMAT A30
SELECT owner,
object_type,
object_name,
status
FROM dba_objects
WHERE status = 'INVALID'
ORDER BY owner, object_type, object_name;
Page | 3
Step 2: Download patch
From the tabs grouped above, select the tab Patches & Updates, select the Product or Family tab
Search for the desired patch. e.g for product – Oracle Database -Enterprise, Realease – Oracle
databases 19.0.0.0.0 and my platform – linux x86-64 – then select Search.
Page | 4
Click on the patch name link, 3692597 for the database release update, you will be redirected to a
new page for download
It is important to always review the README file that accompanies patches, as it contains detailed
instructions for proper installation. For example, the README for this patch states:
“You must use the OPatch utility version 12.2.0.1.43 or later to apply this patch. Oracle recommends
using the latest available OPatch version for 12.2, which can be downloaded from My Oracle Support
(Patch 6880880) by selecting the ARU link for the 12.2.0.1.0 OPatch release.”
Page | 5
Download the file.
Page | 6
STEP 4: Upgrade the Opatch Tool.
Now, let’s upgrade the OPatch tool. We would make a directory for the downloaded software, Move
the downloaded patches to the new directory and grant ownership to the oracle user.
[root@oracle ~]# ls
anaconda-ks.cfg p36912597_190000_Linux-x86-64.zip p6880880_190000_Linux-x86-64.zip
[root@oracle ~]# mkdir /home/oracle/software
[root@oracle ~]# mv /root/p36912597_190000_Linux-x86-64.zip /home/oracle/software
[root@oracle ~]# mv /root/p6880880_190000_Linux-x86-64.zip /home/oracle/software
[root@oracle ~]# chown -R oracle:oinstall /home/oracle/software
We created a backup of the current OPatch directory using today’s date to ensure we can restore it
if needed.
[oracle@oracle db_1]$ mv OPatch/ OPatch_20241016
[oracle@oracle db_1]$ ls OPatch
[oracle@oracle db_1]$ mv OPatch/ OPatch_20241016
[oracle@oracle db_1]$ ls OPatch
To install the new opatch tool, Copy the downloaded OPatch zip file to the ORACLE_HOME
directory:
Make sure you are logged in as the oracle user and unzipped.
Page | 8
one can also take the back up; by creating the pfile from spfile and taking the backup of the control
file
Page | 9
Subsequently, in another tab, you can use the tail command to monitor the log for progress.
Page | 10
The patch has been successfully applied.
Page | 11
The Datapatch utility must be run to complete the post-install SQL deployment for the applied
patch. Since my environment is a container database, I will open my PDBs and execute the
command. If any PDB is in a mounted state, the Datapatch utility will not apply to it.
Page | 12
We can confirm that the patch status is successful. The Datapatch utility executes the necessary
apply script to load the modified SQL files into the database. It is clear that the patch has been
applied successfully for the container CDB.
Page | 13
We can see that the pdbs are in restricted status. No one can work in restricted status. We need to
restart the database to fix it. Then open the pluggable database.
You can query CDB_REGISTRY_SQLPATCH to make sure that all containers have "Database Release
Update : 19.25.0.0.241015 (36912597)",36912597 installed.
Page | 14
Now, let's identify and recompile any invalid objects in each container. To check for invalid objects,
we can query the ALL_OBJECTS or DBA_OBJECTS views. To recompile these invalid objects, we
will use the UTL_RECOMP script (utlrp.sql).
Page | 15
Connect to sql: Check Patches status to confirm the patch
SET LINESIZE 500
SET PAGESIZE 1000
SET SERVEROUT ON
SET LONG 2000000
COLUMN action_time FORMAT A12
COLUMN action FORMAT A10
COLUMN comments FORMAT A30
COLUMN description FORMAT A60
COLUMN namespace FORMAT A20
COLUMN status FORMAT A10
Page | 16
We successfully applied the Oracle 19c patch, enhancing security and performance.
Page | 17