How to Apply Patch On Oracle 19c Database Release Update 19.15.0.0.220419 using Oracle opatch utility? ——learnomate

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
PATCHING ACTIVITY 19c DATABASE
  • ANKUSH THAVALI
  • 23 May, 2022
  • 0 Comments
  • 6 Mins Read

How to Apply Patch On Oracle 19c Database Release Update 19.15.0.0.220419 using Oracle opatch utility? ——learnomate

How to Apply Patch On Oracle 19c Database Release Update 19.15.0.0.220419 using Oracle opatch utility?

 

0

Get the patch # that you want to download. 

  • For this document, I am using the following:

    • Patch# is 33859214

1

Download Patch from Oracle Support.

https://support.oracle.com/ for the platform your database is hosted on. 


In this case, my database is hosted on 64-Bit Linux.

Zip File Name:

p33859214_19150000_Linux-x86-64.zip


9

Ensure ORACLE_HOME environment is set

echo $ORACLE_HOME


$echo $ORACLE_HOME

/u01/app/oracle/product/19.3.0/dbh_12

$

10

Check the current Patcheset.

opatch lsinventory

$opatch lsinv |grep applied

Patch  29585399     : applied on Thu Apr 18 02:21:33 CDT 2019

Patch  29517242     : applied on Thu Apr 18 02:21:17 CDT 2019

$opatch lsinv |grep desc

ARU platform description:: Linux x86-64

Patch description:  “OCW RELEASE UPDATE 19.3.0.0.0 (29585399)”

Patch description:  “Database Release Update : 19.3.0.0.190416 (29517242)”

$opatch lspatches -oh /u01/app/oracle/product/19.3.0/dbh_12

29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)

29517242;Database Release Update : 19.3.0.0.190416 (29517242)


OPatch succeeded.

$


11

Unzip the patch

cd $cd /u99/software/Patches/


unzip p33859214_19150000_Linux-x86-64.zip





12

Verify the Patch Directory is created. In this case, a directory called 33859214 is created.



13

Determine whether any currently installed interim patches conflict with this patch 


From readme.txt



% $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/33803476/33806152

% $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/33803476/33815596

$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u99/software/Patches/33859214/33803476/33806152




$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u99/software/Patches/33859214/33803476/33815596


14

Run OPatch System Space Check


from readme.txt



For Oracle home, as home user:

Create file /tmp/patch_list_dbhome.txt with the following content:
% cat /tmp/patch_list_dbhome.txt

<UNZIPPED_PATCH_LOCATION>/33803476/33806152

<UNZIPPED_PATCH_LOCATION>/33803476/33815596

  1.  

Run OPatch command to check if enough free space is available in the Oracle home:
% $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_dbhome.txt

The command output reports pass and fail messages as per the system space availability:

  • If OPatch reports Prereq “checkSystemSpace” failed., then cleanup the system space as the required amount of space is not available.

  • If OPatch reports Prereq “checkSystemSpace” passed., then no action is needed. Proceed with patch installation.


vi /tmp/patch_list_dbhome.txt

/u99/software/Patches/33859214/33803476/33806152

/u99/software/Patches/33859214/33803476/33815596

:wq!



cat /tmp/patch_list_dbhome.txt



 $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_dbhome.txt


15

Check Patches status before apply using below query

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


SELECT TO_CHAR(action_time, ‘YYYY-MM-DD’) AS action_time,action,status,

description,patch_id FROM sys.dba_registry_sqlpatch ORDER by action_time;



col comp_id for a10

col version for a11

col status for a10

col comp_name for a37

select comp_id,comp_name,version,status from dba_registry;


16

Identifying Invalid Objects before patching

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;

17

Database Downtime Begins here

 

18

Find all listeners running from the ORACLE_HOME you are patching

Ensure that all listeners running from this database home should be down. To find what listeners are associated with this ORACLE_HOME, run the following:


  • ps -ef |grep lsnr |awk  ‘{print $8 $9}’ |grep -v grep

19

Shutdown Listener that is associated with this ORACLE_HOME you are patching.

  • lsnrctl stop LISTENER

20

Find all DATABASES running from the ORACLE_HOME you are patching:

  • echo $ORACLE_HOME

  • ls -1 $ORACLE_HOME/dbs/init* $ORACLE_HOME/dbs/spfile* 

21

Stop all instances running from the ORACLE_HOME you are patching:

  • . oraenv → DBPA

  • sqlplus / as sysdba

  • shutdown immediate;


22

Verify listener and instances associated with ORACLE_HOME you are patching are completely down.

  • ps -ef |grep lsnr |grep LISTENER |grep -v grep

  • ps -ef |grep pmon |grep DBPA |grep -v grep

23

Take Backup of ORACLE_HOME and Database (Rollback plan)

cd $ORACLE_HOME

tar -cvf oracle_home_17

May_2022.tar $ORACLE_HOME

Connect with rman take full backup

24

Change directory to Patch’s Staging Directory

  • cd /u01/app/oracle/product/19.3.0/dbh_12/PATCHES/33859214/33803476/33806152


/u01/app/oracle/product/19.3.0/dbh_12/PATCHES/33859214/33803476/33806152



25

At this point, patch can be installed. 

  • opatch apply



$pwd

/u01/app/oracle/product/19.3.0/dbh_12/PATCHES/33859214/33803476/33815596

$opatch apply




26

Verify patches are applied

  • opatch lsinventory

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 – Production

Version 19.15.0.0.0

$opatch lsinv |grep applied

Patch  33815596     : applied on Wed May 18 00:20:15 CDT 2022

Patch  33806152     : applied on Wed May 18 00:01:01 CDT 2022

$opatch lsinv |grep desc

ARU platform description:: Linux x86-64

Patch description:  “OCW RELEASE UPDATE 19.15.0.0.0 (33815596)”

Patch description:  “Database Release Update : 19.15.0.0.220419 (33806152)”

$opatch lspatches -oh /u01/app/oracle/product/19.3.0/dbh_12

33815596;OCW RELEASE UPDATE 19.15.0.0.0 (33815596)

33806152;Database Release Update : 19.15.0.0.220419 (33806152)


OPatch succeeded.


27

Once the opatch is completed its patching:

  • startup LISTENER

  • Startup INSTANCE(S).

  • lsnrct start 



  • . oraenv →DBPA

  • sqlplus / as sysdba

    • startup



28

Verify listener and instances are started.

  • ps -ef |grep lsnr |grep LISTENER |grep -v grep

  • ps -ef |grep pmon |grep DBPA|grep -v grep

29

Execute post patch steps and run datapatch command

$cd $ORACLE_HOME/OPatch

$./datapatch -verbose





31

Check opatch lsinventory and list of patches applied in ORACLE_HOME

$opatch lsinv |grep applied

Patch  33815596     : applied on Wed May 18 00:20:15 CDT 2022

Patch  33806152     : applied on Wed May 18 00:01:01 CDT 2022

$opatch lsinv |grep desc

ARU platform description:: Linux x86-64

Patch description:  “OCW RELEASE UPDATE 19.15.0.0.0 (33815596)”

Patch description:  “Database Release Update : 19.15.0.0.220419 (33806152)”

$opatch lspatches -oh /u01/app/oracle/product/19.3.0/dbh_12

33815596;OCW RELEASE UPDATE 19.15.0.0.0 (33815596)

33806152;Database Release Update : 19.15.0.0.220419 (33806152)



32

Recompile invalid Objects

select count(*) from all_objects where status = ‘INVALID’ group by owner;



SQL> @?/rdbms/admin/utlrp.sql


SQL> select count(*) from all_objects where status = ‘INVALID’ group by owner;


2.

WinSCP to Server:$ORACLE_HOME/Patches_Staging_Area




3.

Extract Patch to get the ReadMe.txt

30.


After applying RU patch,Check the DBA_REGISTRY_SQLPATCH


SET LINESIZE 500

SET PAGESIZE 1000

SET SERVEROUT ON

SET LONG 2000000

COLUMN action_time FORMAT A12

COLUMN action FORMAT A10

COLUMN patch_type FORMAT A10

COLUMN description FORMAT A32

COLUMN status FORMAT A10

COLUMN version FORMAT A10

spool check_patches_19c.txt


select CON_ID,

TO_CHAR(action_time, ‘YYYY-MM-DD’) AS action_time,

PATCH_ID,

PATCH_TYPE,

ACTION,

DESCRIPTION,

SOURCE_VERSION,

TARGET_VERSION

from CDB_REGISTRY_SQLPATCH

order by CON_ID, action_time, patch_id;

spool off




4.

From the ReadMe.txt file, ensure if the patch is:

  • Online Patchable → Ensure that all the services in the Oracle home are up
    (OR)

  • Offline Patchable → Ensure that all the services in the Oracle home are down 

5.

Set ORACLE_SID

. oreanv → DBPA

6.

Export PATH to OPatch location


export PATH=$ORACLE_HOME/OPatch:$ORACLE_HOME/bin:$PATH



7.

From the Read.me file, opatch version should be the latest version. To find the current opatch version, check the Patch 6880880.


From Readme.txt

opatch version


8.

Upgrade Opatch Tool from 12.2.0.1.17 to 12.2.0.1.30

$pwd

/u99/software/Patches

$cp p6880880_210000_Linux-x86-64.zip /u01/app/oracle/product/19.3.0/dbh_12

cd /u01/app/oracle/product/19.3.0/dbh_12

mv OPatch/ OPatch_BKP


$cd /u01/app/oracle/product/19.3.0/dbh_12


$mv OPatch/ OPatch_BKP

$ls -ltrh  p6880880_210000_Linux-x86-64.zip

-rwxr-xr-x. 1 oracle oinstall 119M May 17 21:53 p6880880_210000_Linux-x86-64.zip


$pwd

/u01/app/oracle/product/19.3.0/dbh_12

$unzip  p6880880_210000_Linux-x86-64.zip




opatch version



No

Description

Screenshot / Command / Others

Hope it Helps.