### login as GRID ###
-- ==================================================================
-- 0. Patch Installation Checks
-- ==================================================================
### BEFORE APPLYING THE PATCH ###
cluvfy stage -pre patch
This software is "1204" days old.
It is a best practice to update the CRS home by downloading and applying the latest release update.
Refer to MOS note 2731675.1 for more details.
CVU operation performed: stage -pre patch
Date: Oct 24, 2024 9:07:55 PM
Clusterware version: 21.0.0.0.0
CVU home: /u01/app/21.3.0.0/grid
Grid home: /u01/app/21.3.0.0/grid
User: grid
Operating system: Linux4.18.0-553.8.1.el8_10.x86_64
### AFTER APPLYING THE PATCH ###
cluvfy stage -post patch
Performing following verification checks ...
cluster upgrade state ...
Oracle Clusterware active patch level is "0".
Node Name Software Patch Software Patch Release Patch
Level(OCR) Level(OLR) Level
------------------------------------------------------------------------
node1 2018261355 2018261355 2018261355
node2 2018261355 2018261355 2018261355
CVU operation performed: stage -post patch
Date: Oct 24, 2024 11:26:27 PM
CVU version: 21.16.0.0.0 (100824x8664)
Clusterware version: 21.0.0.0.0
CVU home: /u01/app/21.3.0.0/grid
Grid home: /u01/app/21.3.0.0/grid
User: grid
Operating system: Linux4.18.0-553.8.1.el8_10.x86_64
### login as ROOT ###
-- ==================================================================
-- 1. Check the release of OPatch Grid e Database:
-- ==================================================================
/u01/app/21.3.0.0/grid/OPatch/opatch version
OPatch Version: 12.2.0.1.26
OPatch succeeded.
/u01/app/oracle/product/21.3.0/dbhome_1/OPatch/opatch version
OPatch Version: 12.2.0.1.26
OPatch succeeded.
-- ==================================================================
-- 2. Check folder softwares:
-- ==================================================================
[root@node1 softwares]# ls -1
p6880880_210000_Linux-x86-64.zip ---> OPatch Tool
p36990664_210000_Linux-x86-64.zip ---> Patch GI Release
p36991631_210000_Linux-x86-64.zip ---> Patch Database Release
-- ==================================================================
-- 3. Rename the existing OPatch folder from the GI home and Oracle database home.
-- ==================================================================
mv -v /u01/app/21.3.0.0/grid/OPatch /u01/app/21.3.0.0/grid/OPatch_old
renamed ..
mv -v /u01/app/oracle/product/21.3.0/dbhome_1/OPatch /u01/app/oracle/product/21.3.0/dbhome_1/OPatch_old
renamed..
-- ==================================================================
-- 02. DOWNLOAD OPatch and CRITICAL PATCH UPDATES
-- ==================================================================
OPatch Tool: https://updates.oracle.com/download/6880880.html
Critical Patch Updates: https://www.oracle.com/security-alerts/
-- ==================================================================
-- 3. Unzip the Patch
-- ==================================================================
cd /softwares
unzip -q p6880880_210000_Linux-x86-64.zip -d /u01/app/21.3.0.0/grid/
unzip -q p6880880_210000_Linux-x86-64.zip -d /u01/app/oracle/product/21.3.0/dbhome_1
-- ==================================================================
-- 4. Change the ownership of the Opatch directory files to the home owner/group
-- ==================================================================
chown -R grid:oinstall /u01/app/21.3.0.0/grid/OPatch
chown -R oracle:oinstall /u01/app/oracle/product/21.3.0/dbhome_1/OPatch
-- ==================================================================
-- 5. Verify the OPatch has been upgraded
-- ==================================================================
/u01/app/21.3.0.0/grid/OPatch/opatch version
OPatch Version: 12.2.0.1.44
OPatch succeeded.
/u01/app/oracle/product/21.3.0/dbhome_1/OPatch/opatch version
OPatch Version: 12.2.0.1.44
OPatch succeeded.
-- ==================================================================
-- 6. Remove the existing OPatch folder from the GI home and Oracle database home
-- ==================================================================
rm -fr /u01/app/21.3.0.0/grid/OPatch_old
rm -fr /u01/app/oracle/product/21.3.0/dbhome_1/OPatch_old
-- ==================================================================
-- 7. Repeat the same procedure in the other nodes
-- ==================================================================
ssh node2
/u01/app/21.3.0.0/grid/OPatch/opatch version
/u01/app/oracle/product/21.3.0/dbhome_1/OPatch/opatch version
mv -v /u01/app/21.3.0.0/grid/OPatch /u01/app/21.3.0.0/grid/OPatch_old
mv -v /u01/app/oracle/product/21.3.0/dbhome_1/OPatch /u01/app/oracle/product/21.3.0/dbhome_1/OPatch_old
unzip -q /softwares/p6880880_210000_Linux-x86-64.zip -d /u01/app/21.3.0.0/grid/
unzip -q /softwares/p6880880_210000_Linux-x86-64.zip -d /u01/app/oracle/product/21.3.0/dbhome_1
chown -R grid:oinstall /u01/app/21.3.0.0/grid/OPatch
chown -R oracle:oinstall /u01/app/oracle/product/21.3.0/dbhome_1/OPatch
/u01/app/21.3.0.0/grid/OPatch/opatch version
/u01/app/oracle/product/21.3.0/dbhome_1/OPatch/opatch version
rm -fr /u01/app/21.3.0.0/grid/OPatch_old
rm -fr /u01/app/oracle/product/21.3.0/dbhome_1/OPatch_old
-- ==================================================================
-- 8. Validate the OPatch can retrieve the stack components and their versions.
-- ==================================================================
## If the following commands fail, stop at this step.
## You cannot proceed with applying the PSU and you need to receive Oracle support to look into the issue.
su - grid
$ORACLE_HOME/OPatch/opatch lsinventory -detail
su - oracle
$ORACLE_HOME/OPatch/opatch lsinventory
-- ==================================================================
-- 9. Unzip the Patchs
-- ==================================================================
[root@node1]# cd /softwares; ls -1
p36990664_210000_Linux-x86-64.zip ---> Patch GI Release
unzip -oq /softwares/p36990664_210000_Linux-x86-64.zip
## Patch 36990664 - GI Release Update 21.16.0.0.241015 ##
36990664/
36772575/
36949613/
36991631/ ===> ## Patch 36991631 - Database Release Update 21.16.0.0.241015 ##
36999645/
37157122/
-- ==================================================================
-- 10. Change Owner e permission
-- ==================================================================
chown -R grid:oinstall /softwares/36990664
chown -R oracle:oinstall /softwares/36991631
chmod 775 -R /softwares
[root@node1 softwares]# ll
drwxrwxr-x. 9 grid oinstall 36990664
drwxrwxr-x. 5 oracle oinstall 36991631
-- ==================================================================
-- 11. Run OPatch Conflict Check :: GRID
-- ==================================================================
# SINTAX: $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /GGGGGGG/NNNNNN
/u01/app/21.3.0.0/grid/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /softwares/36990664/36991631
/u01/app/21.3.0.0/grid/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /softwares/36990664/36999645
/u01/app/21.3.0.0/grid/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /softwares/36990664/37157122
/u01/app/21.3.0.0/grid/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /softwares/36990664/36772575
/u01/app/21.3.0.0/grid/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /softwares/36990664/36949613
/u01/app/21.3.0.0/grid/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /softwares/36990664/36718064
Oracle Interim Patch Installer version 12.2.0.1.44
Copyright (c) 2024, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/21.3.0.0/grid
Central Inventory : /u01/app/oraInventory
from : /u01/app/21.3.0.0/grid/oraInst.loc
OPatch version : 12.2.0.1.44
OUI version : 12.2.0.9.0
Log file location : /u01/app/21.3.0.0/grid/cfgtoollogs/opatch/opatch2024-10-24_20-48-39PM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
-- ==================================================================
-- 12. Run OPatch opatchauto Apply Analyze
-- ==================================================================
### As the ROOT home user: ###
export PATH=$PATH:/u01/app/21.3.0.0/grid/OPatch
cd /softwares/36990664/
opatchauto apply -analyze
OPatchauto session is initiated at Thu Oct 24 20:26:37 2024
System initialization log file is /u01/app/21.3.0.0/grid/cfgtoollogs/opatchautodb/systemconfig2024-10-24_08-26-44PM.log.
Session log file is /u01/app/21.3.0.0/grid/cfgtoollogs/opatchauto/opatchauto2024-10-24_08-27-34PM.log
Executing OPatch prereq operations to verify patch applicability on home /u01/app/21.3.0.0/grid
Patch applicability verified successfully on home /u01/app/21.3.0.0/grid
...
Executing patch validation checks on home /u01/app/oracle/product/21.3.0/dbhome_1
Patch validation checks successfully completed on home /u01/app/oracle/product/21.3.0/dbhome_1
Verifying SQL patch applicability on home /u01/app/oracle/product/21.3.0/dbhome_1
-- ==================================================================
-- 13. Run OPatch OPatchAuto Apply
-- ==================================================================
export PATH=$PATH:/u01/app/21.3.0.0/grid/OPatch
opatchauto apply
### See Another terminal ###
tail -f /u01/app/21.3.0.0/grid/cfgtoollogs/opatchautodb/systemconfig2024-10-25_08-46-11PM.log
# If Opatch fails, it stops with error and saves details about the error in a log file.
# If this happens to you, consider performing the following:
# a) Look into the log file reported by the Opatch.
# b) Fix the root cause of the reported issue.
# c) Resume the Opatch using the following command:
opatchauto apply resume
=======================================
### ALTERNATIVE: APPLY one by one ###
=======================================
/u01/app/21.3.0.0/grid/OPatch/opatch apply -oh /u01/app/21.3.0.0/grid -local -silent /softwares/36990664/36991631
/u01/app/21.3.0.0/grid/OPatch/opatch apply -oh /u01/app/21.3.0.0/grid -local -silent /softwares/36990664/36999645
/u01/app/21.3.0.0/grid/OPatch/opatch apply -oh /u01/app/21.3.0.0/grid -local -silent /softwares/36990664/37157122
/u01/app/21.3.0.0/grid/OPatch/opatch apply -oh /u01/app/21.3.0.0/grid -local -silent /softwares/36990664/36772575
/u01/app/21.3.0.0/grid/OPatch/opatch apply -oh /u01/app/21.3.0.0/grid -local -silent /softwares/36990664/36949613
/u01/app/21.3.0.0/grid/OPatch/opatch apply -oh /u01/app/21.3.0.0/grid -local -silent /softwares/36990664/36718064
Oracle Interim Patch Installer version 12.2.0.1.44
Copyright (c) 2024, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/21.3.0.0/grid
Central Inventory : /u01/app/oraInventory
from : /u01/app/21.3.0.0/grid/oraInst.loc
OPatch version : 12.2.0.1.44
OUI version : 12.2.0.9.0
Log file location : /u01/app/21.3.0.0/grid/cfgtoollogs/opatch/opatch2024-10-25_21-26-32PM_1.log
Verifying environment and performing prerequisite checks...
....
-- ==================================================================
-- 14. Verify that the patches have been applied in srv1.
-- ==================================================================
su - grid
$ORACLE_HOME/OPatch/opatch lsinventory -detail
$ORACLE_HOME/OPatch/opatch lsinventory | grep -i "applied on"
su - oracle
$ORACLE_HOME/OPatch/opatch lsinventory
-- ==================================================================
-- 15. Verify that the database is up and running in its nodes.
-- ==================================================================
srvctl status database -d ORCL -v
-- ==================================================================
-- 12. Check Patching Sanity
-- ==================================================================
$ORACLE_HOME/OPatch/datapatch -sanity_checks
SQL Patching sanity checks version 19.24.0.0.0
Copyright (c) 2021, 2024, Oracle. All rights reserved.
Checks completed. Printing report:
...
Check: Locale - OK
SQL Patching sanity checks completed.
-- ==================================================================
-- 13. Ele carrega dados SQL modificados.
-- ==================================================================
$ORACLE_HOME/OPatch/datapatch -verbose
Copyright (c) 2012, 2024, Oracle. All rights reserved.
...
SQL Patching tool complete
-- ==================================================================
-- 14. Check the patch SQL
-- ==================================================================
sqlplus / as sysdba
SELECT DESCRIPTION FROM DBA_REGISTRY_SQLPATCH ORDER BY ACTION_TIME DESC;
-- ==================================================================
-- 15. Recompilar Objetos Inválidos
-- ==================================================================
@?/rdbms/admin/utlrp.sql
-- ==================================================================
-- 16. Check if the patch has been applied with SQLPLUS (SYSDBA)
-- ==================================================================
SELECT * FROM SYS.REGISTRY$HISTORY;
SELECT DBMS_QOPATCH.GET_OPATCH_LIST FROM DUAL;
##-- SYS.REGISTRY$HISTORY-- ##
COLUMN action_time FORMAT A20
COLUMN action FORMAT A20
COLUMN version FORMAT A10
COLUMN comments FORMAT A30
COLUMN bundle_series FORMAT A10
SELECT
TO_CHAR(ACTION_TIME, 'DD-MON-YYYY HH24:MI:SS') AS ACTION_TIME,
ACTION, VERSION, ID, COMMENTS, BUNDLE_SERIES
FROM SYS.REGISTRY$HISTORY
ORDER BY ACTION_TIME;
##--DBA_REGISTRY_SQLPATCH-- ##
COL ACTION_TIME FOR A28
COL ACTION FOR A8
COL TARGET_VERSION FOR A8
COL COMMENTS FOR A30
COL STATUS FOR A10
SET LINE 999 PAGES 999
SELECT
PATCH_ID, TARGET_VERSION, STATUS, ACTION, ACTION_TIME
FROM DBA_REGISTRY_SQLPATCH
ORDER BY ACTION_TIME;
-- ==================================================================
-- 17. Check if the patch has been applied with DBMS
-- ==================================================================
##--Put patch number which you want to check -- ##
SELECT
XMLTRANSFORM(DBMS_QOPATCH.IS_PATCH_INSTALLED ('XXXX'),
DBMS_QOPATCH.GET_OPATCH_XSLT) "PATCH INSTALLED?"
FROM DUAL;
##-- VERIFIQUE TODOS OS PATCHES APLICADOS DO DBMS --##
SET SERVEROUT ON;
EXEC DBMS_QOPATCH.GET_SQLPATCH_STATUS;