Wednesday, 30 October 2019

Patch Application (GI Home & DB Home) /Applying/Installing the Patch from an Oracle RAC Home Installation Manually

Oracle provides you a patches each quarter, either to fix the bugs reported or to improve performance of DB or security measure. In this blog, i will demonstrate how to apply patch to two nodes RAC of version 11.2.0.4
Download the patch from oracle support website using support id, place that patch on the oracle server and unzip that folder.

1- we have to create ocm file, it is basically a parameters file, which will be used during patch application.

Creation of OCM_FILE

/u01/app/11.2.0/grid/OPatch/ocm/bin/emocmrsp  -no_banner -output /u01/app/11.2.0/grid/ocm_file.rsp






2- Login through oracle user and stop the executable used, by issuing below command:

/u01/app/oracle/product/11.2.0/bin/srvctl stop home -o /u01/app/oracle/product/11.2.0 -s /tmp/state1.txt -n racnode1




3- Stop all the RAC services on that specific node, by issued below command:



4- Once all the service are down, its the time to patch up the Grid home:
 a- Apply first patch using command:
/u01/app/11.2.0/grid/OPatch/opatch napply -oh /u01/app/11.2.0/grid -local /u01/30070097/29938455 -ocmrf /u01/app/11.2.0/grid/ocm_file.rsp



b- Apply second patch:
/u01/app/11.2.0/grid/OPatch/opatch apply -oh /u01/app/11.2.0/grid -local /u01/30070097/29509309 -ocmrf /u01/app/11.2.0/grid/ocm_file.rsp


 c- Apply the third patch:
/u01/app/11.2.0/grid/OPatch/opatch apply -oh /u01/app/11.2.0/grid -local /u01/30070097/29913194 -ocmrf /u01/app/11.2.0/grid/ocm_file.rsp



All three patches are successfully applied to GRID_HOME, Now we need to switch to DB_HOME to apply patches given by oracle for DB_HOME
Before application of application we need to run some preopatch command:

/u01/30070097/29938455/custom/server/29938455/custom/scripts/prepatch.sh -dbhome /u01/app/oracle/product/11.2.0


Apply first patch to DB Home:

/u01/app/oracle/product/11.2.0/OPatch/opatch napply -oh /u01/app/oracle/product/11.2.0 -local /u01/30070097/29938455/custom/server/29938455/ -ocmrf /u01/app/11.2.0/grid/ocm_file.rsp



 Apply second patch to DB Home:

/u01/app/oracle/product/11.2.0/OPatch/opatch apply -oh /u01/app/oracle/product/11.2.0 -local /u01/30070097/29913194 -ocmrf /u01/app/11.2.0/grid/ocm_file.rsp



Once all patches provided are applied, we have to run postpatch command as below:

/u01/30070097/29938455/custom/server/29938455/custom/scripts/postpatch.sh -dbhome /u01/app/oracle/product/11.2.0

Exit from Oracle User and login to root user and execute below command:

/u01/app/11.2.0/grid/rdbms/install/rootadd_rdbms.sh


Now starting high availiblity services:

 /u01/app/11.2.0/grid/crs/install/rootcrs.pl -patch


All patches have successfully been applied to GI and Oracle home now we need to apply
Loading Modified SQL Files into the Database

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> QUIT

When it is completed now you can check the status of patches applied using patch inventory command:

/u01/app/oracle/product/11.2.0/OPatch/opatch lsinventory












Tuesday, 29 October 2019

Patch Deinstallaion (GI Home & DB Home) /Rolling Back the Patch from an Oracle RAC Home Installation Manually

Oracle sends patches each quarter or against any bug reported by end user. In this blog we will demonstrate how to deinstall or rolling back oracle patch provided by oracle on 16 Oct 2019, Patch applied to GI Home and DB Home. Execute the following on each node of the cluster in non-shared CRS and DB home environment to rollback the patch.

First of all we have to check the patch number which are applied to GI home and DB home, by issuing command:

1- $ GI_HOME/OPatch/Opatch lsinventory

It will display all the main patches, subpatches and the bugs fixed by that patch:

similarly from oracle home we should issue the same commad to check the patches number:
$ ORACLE_HOME/OPatch/opatch lsinventory

2- Stop the CRS managed resources running from DB homes.
$ <ORACLE_HOME>/bin/srvctl stop home -o <ORACLE_HOME> -s <status file location> -n <node name>

$ /u01/app/11.2.0/grid/bin/srvctl stop home -o /u01/app/11.2.0/grid -s /tmp/statedeinstall.txt -n racnode2

now check the status:

Now bring down all the services using command :
3- Run the pre root script.
 If this is a GI Home, as the root user execute:
 # <GI_HOME>/crs/install/rootcrs.pl -unlock

#
/u01/app/11.2.0/grid/crs/install/rootcrs.pl -unlock

4- Now rolling back the Patches :

As the GI home owner execute:
 $ <GI_HOME>/OPatch/opatch rollback -local -id <OCW Components_number> -oh <GI_HOME>


$ /u01/app/11.2.0/grid/OPatch/opatch rollback -local -id  29938455 -oh /u01/app/11.2.0/grid       

$ <GI_HOME>/OPatch/opatch rollback -local -id <ACFS Components_number> -oh <GI_HOME>

$/u01/app/11.2.0/grid/OPatch/opatch rollback -local -id  29509309 -oh /u01/app/11.2.0/grid

$ <GI_HOME>/OPatch/opatch rollback -local -id <DB_PSU_number> -oh <GI_HOME>

$ /u01/app/11.2.0/grid/OPatch/opatch rollback -local -id  29913194 -oh /u01/app/11.2.0/grid

 -------------------------------DB Home Patches Deinstallation------------------------------------------

 5- Run the pre script for DB component of the patch.

 As the database home owner execute:
 $ <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<OCW Components_number>/custom/server/<OCW Components_number>/custom/scripts/prepatch.sh -dbhome <ORACLE_HOME>

$ /u01/30070097/29938455/custom/server/29938455/custom/scripts/prepatch.sh -dbhome /u01/app/oracle/product/11.2.0


-- Roll back the DB patch from the database home.
 As the database home owner execute:
 $ <ORACLE_HOME>/OPatch/opatch rollback -local -id <OCW Components_number> -oh <ORACLE_HOME>

$ /u01/app/oracle/product/11.2.0/OPatch/opatch rollback -local -id /u01/30070097/29938455/ -oh /u01/app/oracle/product/11.2.0

$ <ORACLE_HOME>/OPatch/opatch rollback -local -id <DB_PSU_number> -oh <ORACLE_HOME>


$/u01/app/oracle/product/11.2.0/OPatch/opatch rollback -local -id 29913194 -oh /u01/app/oracle/product/11.2.0

6-  Run the post script for DB component of the patch.
 As the database home owner execute:
 $ <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<OCW Components_number>/custom/server/<OCW Components_number>/custom/scripts/postpatch.sh -dbhome <ORACLE_HOME>


 $/u01/30070097/29938455/custom/server/29938455/custom/scripts/postpatch.sh -dbhome /u01/app/oracle/product/11.2.0

/**************************DONE*********************************/

7. Run the post script.
 As the root user execute:
 # <GI_HOME>/rdbms/install/rootadd_rdbms.sh



 $ /u01/app/11.2.0/grid/rdbms/install/rootadd_rdbms.sh

If this is a GI Home, as the root user execute:
 # <GI_HOME>/crs/install/rootcrs.pl -patch


$ /u01/app/11.2.0/grid/crs/install/rootcrs.pl -patch

 Now checking the Database instance status after the patches are being successfully deinstalled.
Both nodes are up & running:


Checking the GI Home for patches, check patch inventory

$ /u01/app/11.2.0/grid/OPatch/opatch lsinventory

 There is no interim patch installed.

Now checking the DB home:

$ /u01/app/oracle/product/11.2.0/OPatch/opatch lsinventory


No interim patch have been installed , one done on all nodes, run Patch Post-Deinstallation Instructions for an Oracle RAC Environment, that are:


Loged in to DB:

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @catbundle_PSU_<database SID PREFIX>_ROLLBACK.sql
SQL> QUIT


In an Oracle RAC environment, the name of the rollback script will have the format catbundle_PSU_<database SID PREFIX>_ROLLBACK.sql.



cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql

Check the log file for any errors. The log file is found in $ORACLE_BASE/cfgtoollogs/catbundle and is named catbundle_PSU_<database SID>_ROLLBACK_<TIMESTAMP>.log where TIMESTAMP is of the form YYYYMMMDD_HH_MM_SS. If there are errors, see Known Issues.

Installing Oracle 11g on Linux

Unpack Files Unzip the files. # 11.2.0.1 unzip linux.x64_11gR2_database_1of2.zip unzip linux.x64_11gR2_database_2of2.zip #11.2.0.2 u...