Apply Patching On Oracle Database Release Update in Multitenant

Prerequisites

Step 1. Take full database RMAN backup.

$ rman target sys/password@ORCLCDB
RMAN> BACKUP DATABASE PLUS ARCHIVELOG DELETE INPUT;
(It will take backup of CDB$ROOT, PDB$SEED, and ALL PDBs)

Step 2. Take Oracle Home Tar Backup:

cd /backup/DBHOMEBKP
tar -cvzf oraclehome17042025.tar.gz /opt/oracle/product/19c/dbhome_1

Step 3. Check invalid objects of CDB and PDB:

col OWNER for a40
select owner, count(*) from dba_objects where status='INVALID' group by owner;

select count(*) from dba_objects where status='INVALID';

Step 4. Check Database Registry:

col DESCRIPTION for a60
col ACTION_TIME for a30
select INSTALL_ID, PATCH_ID, PATCH_UID, ACTION, ACTION_TIME, DESCRIPTION from dba_registry_sqlpatch;

col comp_name for a40
col comp_id for a15
col status for a10
col version for a15
select comp_id, version, comp_name, status from dba_registry;

Step 5. Check OPatch details:

$ cd $ORACLE_HOME/OPatch
$ ./opatch version
$ ./opatch lsinventory
$ ./opatch lspatches

Step 6. Check the Current Database Version:

select banner_full from v$version;

Patching Steps:

Step 1. Stop Database Services:

$ lsnrctl stop

sqlplus / as sysdba
show pdbs; -- close all pdbs
alter pluggable database ORCLPDB close immediate;
alter pluggable database ORCLPDB save state;

alter pluggable database ORCLPDB2 close immediate;
alter pluggable database ORCLPDB2 save state;

shut immediate -- shutdown the CDB

Step 2. Check conflicts:

$ cd $ORACLE_HOME/OPatch
$ ./opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /mnt/Patches/37260974/

$ ./opatch prereq CheckSystemSpace -phBaseDir /mnt/Patches/37260974/

$ ./opatch prereq CheckActiveFilesAndExecutables -phBaseDir /mnt/Patches/37260974/

Step 3. Apply the Patch if no issues found in prechecks:

$ cd /mnt/Patches/37260974/
$ /opt/oracle/product/19c/dbhome_1/OPatch/opatch apply

Step 4. Start Database (CDB+PDB):

sqlplus / as sysdba
startup -- start cdb

show pdbs --start all pdbs
alter pluggable database ORCLPDB open read write;
alter pluggable database ORCLPDB save state;

alter pluggable database ORCLPDB2 open read write;
alter pluggable database ORCLPDB2 save state;

Post Steps:

Step 1. Run datapatch -verbose:

$ cd $ORACLE_HOME/OPatch
$ ./datapatch -verbose

Step 2. Verify the Patch Version and start listener:

select banner_full from v$version;

$ cd $ORACLE_HOME/OPatch
$ ./opatch lspatches

$ lsnrctl start

Step 3. Check Database Registry:

col DESCRIPTION for a60
col ACTION_TIME for a30
select INSTALL_ID, PATCH_ID, PATCH_UID, ACTION, ACTION_TIME, DESCRIPTION from dba_registry_sqlpatch;

col comp_name for a40
col comp_id for a15
col status for a10
col version for a15
select comp_id, version, comp_name, status from dba_registry;

Step 4. Match the invalid object counts of CDB and PDB noted in the pre-checks:

select count(*) from dba_objects where status='INVALID';

col OWNER for a40
select owner,count(*) from dba_objects where status='INVALID' group by owner;

Step 5. Compile the invalid objects if their count increases:

@?/rdbms/admin/utlrp.sql


Post a Comment

© Ayaan Israr - All rights reserved. Premium By Ayaan Israr