DEV Community

technonotes-hacker
technonotes-hacker

Posted on

Patching in Oracle DB - I

  • Patching is in-place NOT Upgrade.
  • Oracle release Quarterly Patches

Image description

  • Base software's( GI Software's & Oracle Software's ) can be downloaded in Oracle Site.
  • Patches can be downloaded from Support Site and also it needs a license.
  • Patches are applied on top of GI Home & Oracle Home.
  • What these Patches contains ?

Image description

  • Where to check what patches are applied ?
    /u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch lspatches
    29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)
    29517242;Database Release Update : 19.3.0.0.190416 (29517242)
    OPatch succeeded.

  • ASM Home

/u01/app/19.0.0.0/grid/OPatch/opatch lspatches
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)
29517247;ACFS RELEASE UPDATE 19.3.0.0.0 (29517247)
29517242;Database Release Update : 19.3.0.0.190416 (29517242)
29401763;TOMCAT RELEASE UPDATE 19.0.0.0.0 (29401763)
Enter fullscreen mode Exit fullscreen mode
  • DB Home
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch lspatches
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)
29517242;Database Release Update : 19.3.0.0.190416 (29517242)
Enter fullscreen mode Exit fullscreen mode
  • 19.3.0.0.190416 --> 190416 --> 2019 - April - Date.
  • Second digit is RU. i.e 19.3
  • RU will be increasing 19.2,19.4 etc
  • Here : 19.3 is the base release. --> GI Home and ASM Home.
  • These are cumulative patches --> all patches are not to be applied one by one , you can jump to any patches.

Overview plan

Image description

How to download & Patch details ?

  • Search like below, Critical Patch Update (CPU) Program Jan/Apr/Jul/Oct 2023 Patch Availability Document (DB-only)
  • Section 3 which is for Oracle Database.
  • 3.1.7 --> 3.1.7.3 which is 19c
  • GI Patch will contain DB patch also.
  • Now go to the READ ME file and check the table 1-2 which will say how many sub patches need to be applied.

OPatch Tool

  • We need to patch 3 home ,
  • GI Home
  • DB Home
  • Database Home

  • All these home will be patched via OPatch Tool.

Best Practice

  • SDLC ( DEV --> UAT --> PROD )
  • Don't rollback of any previous patches.
  • Check the conflict check for all the patches using below command, ( repeat for all 5 patches or sub patches )
/u01/app/19.0.0.0/grid/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patches/19.17/34416665/33575402 -oh /u01/app/19.0.0.0/grid
Enter fullscreen mode Exit fullscreen mode
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patches/19.17/34416665/34419443 -oh /u01/app/oracle/product/19.0.0.0/dbhome_1
Enter fullscreen mode Exit fullscreen mode

Image description

OPatch Patch

  • 6880880 version.
  • Upgrade can be done by downloading.

Steps to apply patch

DB Home patching steps

1) Stop DB Home as root user
2) grant permission on patch directory as root user
3) As oracle user do prechks 
Do OPatch version and current lspatches checks
Conflict pre checks:    
System space prechk:
4) Apply Patch:
5) Post verification
6) Start ORACLE_HOME as root user
Enter fullscreen mode Exit fullscreen mode

GI Home patching steps

  • Stop the GI home as root user, which means its a HAS --> Standalone.
1) Stop GI Home as root user
2) Unlock the GI Home as root user
3) grant permission patch directory as root user
4) As grid/oracle user do prechks 
Do OPatch version and current lspatches checks
Conflict pre checks:    
System space prechk:
5) Apply Patch:
6) Post verification
7) Lock and start GI 
Enter fullscreen mode Exit fullscreen mode

Prechecks

- backup GI Home --> tar -cvzf grid.tar.gz grid ( cd /u01/app/19.0.0.0/ )
- backup Oracle Home --> tar -cvzf dbhome_1.tar.gz dbhome_1 ( cd /u01/app/oracle/product/19.0.0.0 )
Enter fullscreen mode Exit fullscreen mode
  • System space check
/u01/app/19.0.0.0/grid/OPatch/opatch prereq CheckSystemSpace -phBaseDir /u01/patches/19.17/34416665/33575402 -oh /u01/app/19.0.0.0/grid

/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch prereq CheckSystemSpace -phBaseDir /u01/patches/19.17/34416665/34419443 -oh /u01/app/oracle/product/19.0.0.0/dbhome_1
Enter fullscreen mode Exit fullscreen mode
  • df -h /u01/app/oracle/product/19.0.0.0/dbhome_1/

Image description

Patching

/u01/app/19.0.0.0/grid/OPatch/opatch apply -oh /u01/app/19.0.0.0/grid -local -silent /u01/patches/19.17/34416665/34419443

/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch apply -oh /u01/app/oracle/product/19.0.0.0/dbhome_1 -local -silent /u01/patches/19.17/34416665/34419443
Enter fullscreen mode Exit fullscreen mode
  • silent --> default is YES , don't wait for command.

Important Notes

  • Don't download patches until you have license , it may be fine as they are unauthorised to download.
  • List of patches terms used in Oracle :

https://docs.oracle.com/cd/E24628_01/doc.121/e39376/glossary.htm#BGBCGDDF

Image description

Top comments (0)