The quarterly Release Update (RU) is out and the change window is tonight. Applying an RU has two parts, and people often forget the second one:
- OPatch changes the binaries in the Oracle home.
- datapatch changes the SQL and PL/SQL inside every database (and every PDB) that runs from that home.
If you skip datapatch, the binaries and the data dictionary are at different patch levels. The database still opens, but you get odd errors and invalid objects, and the next patch fails its prechecks. This runbook covers both parts plus the rollback.
Before the window
Download the right files
From My Oracle Support you need:
- The RU patch for your platform (for example
p<patch_id>_190000_Linux-x86-64.zip). - The latest OPatch, patch 6880880 for 19c. The RU README gives the minimum OPatch version it needs.
- Optionally the OJVM RU, if you use Java in the database. It is a separate patch with its own README.
Read the README and the RU's "known issues" note before you start. Every RU has a few, and they change the steps.
Check the current state
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
opatch version
opatch lspatches
-- SQL patches registered in the database (run in the root of a CDB)
SELECT patch_id, action, status, action_time, description
FROM dba_registry_sqlpatch
ORDER BY action_time;
-- Invalid objects before patching: save this as a baseline
SELECT owner, object_type, COUNT(*)
FROM dba_objects
WHERE status = 'INVALID'
GROUP BY owner, object_type
ORDER BY owner;
Save the invalid-object count. After patching you compare against it instead of guessing which invalid objects were already broken.
Update OPatch
cd $ORACLE_HOME
mv OPatch OPatch.$(date +%Y%m%d)
unzip -q /stage/p6880880_190000_Linux-x86-64.zip -d $ORACLE_HOME
opatch version
Run the conflict and space prechecks
Unzip the RU to a staging directory and run the checks from inside the patch directory:
cd /stage/ru/<patch_id>
opatch prereq CheckConflictAgainstOHWithDetail -ph ./
echo "/stage/ru/<patch_id>" > /tmp/patch_list.txt
opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list.txt
Both must report Prereq "..." passed. A conflict with an existing one-off patch means you need a merge patch for the new RU. Request it from Oracle Support days before the window, not on the night.
Warning
Take a backup you have actually tested before the window: an RMAN backup of each database plus a tar of the Oracle home and the central inventory (
/u01/app/oraInventoryor wherever/etc/oraInst.locpoints). An OPatch rollback does not help you if the inventory is damaged.
In place or out of place
| Approach | Downtime | Rollback | When to use |
|---|---|---|---|
| In place: patch the running home | The whole apply, often 20-60 minutes plus datapatch | opatch rollback, then datapatch, with another outage | Small estates, labs, servers with no space for a second home |
| Out of place: patch a new home, then move the databases to it | Only the restart and datapatch | Start from the old home again and run datapatch from there | Production. It is Oracle's recommended method |
Both are shown below. In both, every database that runs from the home must be stopped while its binaries change.
Option A: in-place apply
# 1. Stop everything that runs from this home
sqlplus / as sysdba <<'EOF'
SHUTDOWN IMMEDIATE
EOF
lsnrctl stop LISTENER # only if the listener runs from this home
# 2. Confirm nothing still has the home's files open
ps -ef | grep -E "ora_pmon|tnslsnr" | grep -v grep
# 3. Apply the binaries
cd /stage/ru/<patch_id>
opatch apply
OPatch asks you to confirm and then reports OPatch succeeded. If it fails, it says where the log is (under $ORACLE_HOME/cfgtoollogs/opatch/). Read that log before trying again.
Then start the databases and continue with the datapatch section below.
Option B: out-of-place apply
- Install a new 19c home next to the old one, for example
/u01/app/oracle/product/19.0.0/dbhome_2. Either install the base release and apply the RU to it, or apply the RU during installation with./runInstaller -applyRU /stage/ru/<patch_id>. - Copy the configuration each database needs from the old home to the new one:
dbs/spfile<SID>.ora,dbs/orapw<SID>, andnetwork/admin/*.oraif your TNS files live in the home. - In the window, stop the database from the old home, change its entry in
/etc/oratabto the new home, setORACLE_HOMEto the new home and start it. - Run datapatch from the new home.
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_2
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
sqlplus / as sysdba <<'EOF'
STARTUP
EOF
Tip
On Oracle Restart or RAC, change the home in the cluster registry too (
srvctl modify database -db <db_unique_name> -oraclehome <new_home>), otherwise the clusterware starts the database from the old binaries again.
Run datapatch
datapatch only patches containers that are open. In a CDB, open every PDB first:
ALTER PLUGGABLE DATABASE ALL OPEN;
SELECT name, open_mode FROM v$pdbs;
Then run it once per database (on RAC, once from one node):
$ORACLE_HOME/OPatch/datapatch -verbose
It lists the patches it will install in each container, applies them and writes logs under $ORACLE_BASE/cfgtoollogs/sqlpatch/. A PDB that was closed or in restricted mode during the run is skipped. Open it and run datapatch again later; it is safe to rerun.
Verify
-- Every container should show the new RU with STATUS = SUCCESS
SELECT con_id, patch_id, action, status, action_time, description
FROM cdb_registry_sqlpatch
ORDER BY con_id, action_time;
-- Recompile anything left invalid
@?/rdbms/admin/utlrp.sql
-- Compare against the baseline you saved before the window
SELECT owner, object_type, COUNT(*)
FROM dba_objects
WHERE status = 'INVALID'
GROUP BY owner, object_type
ORDER BY owner;
-- Components should be VALID
SELECT comp_id, version, status FROM dba_registry;
opatch lspatches # binaries show the new RU
lsnrctl status # services registered again
Then check the application: connections through the usual service names, a smoke test from the app team, and the alert log for new ORA- errors since startup.
| Symptom after patching | Likely cause | Fix |
|---|---|---|
dba_registry_sqlpatch shows WITH ERRORS | datapatch hit an error in one script | Read the log under cfgtoollogs/sqlpatch, fix the cause (often a locked object or a full tablespace), rerun datapatch -verbose |
| New RU missing in one PDB only | PDB was closed during datapatch | Open the PDB, rerun datapatch |
opatch apply fails with files in use | A process from the home is still running | Stop remaining processes (agent, listener, other instances), check with fuser or lsof, retry |
| More invalid objects than the baseline | Dependencies not yet recompiled | Run utlrp.sql again; raise an SR if core SYS objects stay invalid |
opatch prereq reports a conflict | An existing one-off patch overlaps the RU | Get a merge patch for the new RU from Oracle Support |
Roll back
In place
sqlplus / as sysdba <<'EOF'
SHUTDOWN IMMEDIATE
EOF
opatch rollback -id <patch_id>
sqlplus / as sysdba <<'EOF'
STARTUP
ALTER PLUGGABLE DATABASE ALL OPEN;
EOF
$ORACLE_HOME/OPatch/datapatch -verbose
After the binary rollback, datapatch finds the SQL patch that no longer has binaries and rolls it back in each container.
Out of place
Stop the database, point /etc/oratab (and srvctl, if used) back at the old home, start from the old home and run datapatch from the old home. That rolls the dictionary back to the old patch level. The new home stays installed for the next attempt.
Caution
Do not open a database on the old binaries and leave it running for days without running datapatch. Mismatched binaries and dictionary can cause wrong results and errors that look like corruption.
Prevent it next time
- Patch out of place by default. Build each quarter's home ahead of time, test it on a non-production database, and the window is only a restart plus datapatch.
- Keep a short list of one-off patches per home, so merge patch requests go to Oracle Support as soon as the RU is released.
- Save the
dba_registry_sqlpatchand invalid-object queries as a script that runs before and after every window and keeps its output with the change record. - Patch non-production one cycle earlier than production. For staging rings and rollback rules, see the database patching policy post.
- Remove old homes once their rollback period has passed, so the next out-of-place install has disk space.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get