Wednesday, September 29, 2021

Exacc -- Patching Oracle Grid Infrastructure home and Oracle Databases home Using dbaascli 2.0




There are three methods to patching an EXA-CC.  Each of these methods can be initiated from the cloud console or from the back-end Exadata compute nodes.
Out of Place Patching 
In-Place Patching 
One-off Patching


Prechecks : 
1) Check exiting Patch versions : 
for name in `olsnodes`; do ssh $name -c hostname; ssh $name /u01/app/19.0.0.0/grid/OPatch/opatch lspatches; done
2) Take neccessary backups 
 



1) Check and Update Cloud Tooling

[oracle@host1-db2 ~]$ sudo dbaascli patch tools list

dbaascli admin updateStack --version LATEST
All Nodes have the same tools version


2) Listing Available Software Image and Versions for Database and Grid Infrastructure
sudo dbaascli cswlib showImages

If the Image is not available in the list use the command below to download, although it will be downloaded automatically during patch process.

[oracle@host1-db1 ~]$ sudo dbaascli cswlib download --ohImageType db --imageTag 19.09.0.0.0



3) Apply the Patch on Grid Infrastructure Home  ( in place) 

--> Run Prerequisite Check on all nodes of the cluster
[oracle@host1-db1 ~]$ sudo dbaascli grid patch --targetVersion 19.09.0.0.0 --executePrereqs

--> Apply the Patch on all nodes of the cluster in rolling version  .  


[oracle@host1-db1 ~]$ sudo dbaascli grid patch --targetVersion 19.09.0.0.0 

This will patch all the nodes in the Cluster automatically.

If the DB runs only on a single instance. run the command with option (--continueWithDbDowntime)



--> Verify successful patching

grid@host1-db2 ~]$ $ORACLE_HOME/OPatch/opatch lspatches

dcli -g /tmp/dbs_group -l oracle /u01/app/oracle/product/12.1.0.2/dbhome_1/OPatch/opatch version

for name in `olsnodes`;  do echo $name; ssh $name /u01/app/19.0.0.0/grid/OPatch/opatch lspatches; done > opatch_pre.out



--> Apply one-off Patch if required

 $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail  -ph .

/u01/app/19.0.0.0/grid/crs/install/rootcrs.sh -prepatch

/u01/app/19.0.0.0/grid/OPatch/opatch apply -oh /u01/app/19.0.0.0/grid -local /home/grid/path/patch_id

/u01/app/19.0.0.0/grid/crs/install/rootcrs.sh -postpatch 




using dcli we can  copy to multiple nodes 

dcli -g /tmp/dbs_group -l oracle -f /patches/opatch/p344356_122010_Linux-x86-64.zip -d /tmp

dcli -g /tmp/dbs_group -l oracle "unzip -o /tmp/p344356_122010_Linux-x86-64.zip -d /u01/app/oracle/product/12.1.0.2/dbhome_1; /u01/app/oracle/product/12.1.0.2/dbhome_1/OPatch/opatch version; rm /tmp/344356_122010_Linux-x86-64.zip" | grep Version




4) Apply the Patch on RDBMS Home  ( Out of place ) 

--> List available bundle images

[oracle@host1-db1 ~]$ sudo dbaascli cswlib showImages --product database


--> Download the Image if not listed as available
[oracle@host1-db1 ~]$ sudo dbaascli cswlib download --ohImageType db --imageTag 19.09.0.0.0

--> Optionally Activate the bundle patch image by making it default

[oracle@host1-db1 ~]$ sudo dbaascli dbhome create --version 19000 --bp JAN2020 --oracleHomeName UnifiedAudit_home --enableUnifiedAuditing true


Apply one-off Patch if applicable to the empty home

--> Check the patches in the new home
[oracle@host1-db1 ~]$ export ORACLE_HOME=/u02/app/oracle/product/19.0.0.0/dbhome_1
[oracle@host1-db1 ~]$ $ORACLE_HOME/OPatch/opatch lspatches

--> Check the current home of the database to be patched
[oracle@host1-db1 ~]$ sudo dbaascli dbhome info

--> Run Prerequisite Check before database move

[oracle@host1-db1 ~]$ sudo dbaascli database move --dbname DBNAME--ohome /u02/app/oracle/product/19.0.0.0/dbhome_1  --continuewithdbdowntime --executePrereqs
For standby databases use the -standby option



--> Patch the Database (by moving it to a new home)
[oracle@host1-db1 ~]$ sudo dbaascli database move --dbname DBNAME --ohome /u02/app/oracle/product/19.0.0.0/dbhome_1 --continuewithdbdowntime

--> Verify successful patching of the database
SQL> select BANNER_FULL from v$version;

--> Check if datapatch is applied to the database
select install_id ,PATCH_ID,PATCH_TYPE,ACTION,STATUS,ACTION_TIME,SOURCE_VERSION,TARGET_VERSION from DBA_REGISTRY_SQLPATCH;

If its not applied apply manually  -- only after all nodes done 
$ORACLE_HOME/OPatch/datapatch -verbose


--> Check the Current home of the patched database
[oracle@host1-db1 ~]$ sudo dbaascli dbhome info


--> Remove Old Dbhome 
[root@hostname1 ~]# dbaascli dbhome purge




5) In-Place Patching Method for RDBMS  ( If we dont want  out of box as per step  4) 

[oracle@host1-db1 ~]$ dbaascli dbhome patch -help

--> Find the Current Database Patch Level
[oracle@host1-db1 ~]$ sudo dbaascli dbhome info

--> List available Database Images
[oracle@host1-db1 ~]$ sudo dbaascli cswlib showImages --product database

--> Run Prerequisite Check before patch
[oracle@host1-db1 ~]$ sudo dbaascli dbhome patch --oracleHome /u02/app/oracle/product/19.0.0.0/dbhome_2  --targetVersion 19.10.0.0 --executePrereqs

--> Apply the Patch
nohup sudo dbaascli dbhome patch --oracleHome /u02/app/oracle/product/19.0.0.0/dbhome_2  --targetVersion 19.10.0.0 &



--> Apply one-off Patch if any   + datapatch 

--> Verify successful patching of the database home
[oracle@host1-db1 ~]$ $ORACLE_HOME/OPatch/opatch lspatches

--> Verify the home
[oracle@host1-db1 ~]$ sudo dbaascli dbhome info





6) Roll Back a failed or unwanted Patch 

--> Check current patch before rollback
grid@host1-db2 ~]$ $ORACLE_HOME/OPatch/opatch lspatches

--> Run the rollback
[oracle@host1-db1 ~]$ sudo dbaascli grid patch --targetVersion 19.09.0.0.0 --rollback
[oracle@host1-db2 ~]$ sudo dbaascli grid patch --targetVersion 19.09.0.0.0 --rollback


--> Check the patch Status after rollback
[grid@host1-db1 ~]$ $ORACLE_HOME/OPatch/opatch lspatches
[grid@host1-db1 ~]$ crsctl query crs activeversion -f
grid@host1-db2 ~]$ crsctl query crs activeversion -f



7) Rollback RDBMS Patch 

--> Roll back out-of-place patch
sudo dbaascli database move --dbname DBNAME--ohome /u02/app/oracle/product/19.0.0.0/dbhome_2
--> Roll back in-place patch
sudo dbaascli dbhome patch --oracleHome /u02/app/oracle/product/19.0.0.0/dbhome_2  --targetVersion 19.9.0.0 --rollback 



Reference:
 https://docs.oracle.com/en-us/iaas/Content/Database/References/dbaascli/Patching_Oracle_Grid_Infrastructure_and_Oracle_Databases_Using_dbaascli.htm

https://docs.oracle.com/en/engineered-systems/exadata-cloud-at-customer/ecccm/ecc-using-dbaascli.html#GUID-579052E3-4983-44AD-9521-CF8C425C1ACB
 
https://docs.oracle.com/en-us/iaas/Content/Database/References/dbaascli/Patching_Oracle_Grid_Infrastructure_and_Oracle_Databases_Using_dbaascli.htm#GUID-D92CAF95-43E0-4CFC-8C16-198D5A643CFC


https://docs.oracle.com/en-us/iaas/exadata/doc/troubleshooting.html

No comments:

Post a Comment