Oracle 11g Grid and Database patching
************************
1. Run the pre root script. If this is a GI Home, as the root user execute
***********************************************************************
/optware/grid/11.2.0.4/crs/install/rootcrs.pl -unlock
2. As the GI home owner execute, apply the OCW patch
**************************************************
/optware/grid/11.2.0.4/OPatch/opatch napply -oh /u01/app/11204 -local /u02/patch/22191577/21948348
3. As the GI home owner execute, apply the ACFS patch
**************************************************
/optware/grid/11.2.0.4/OPatch/opatch napply -oh /u01/app/11204 -local /u02/patch/22191577/21948355
4. As the GI home owner execute, apply the DB PSU Patch
*****************************************************
/optware/grid/11.2.0.4/OPatch/opatch apply -oh /u01/app/11204 -local /u02/patch/22191577/21948347
5. Run the post script. As the root user execute:
**********************************************
/optware/grid/11.2.0.4/rdbms/install/rootadd_rdbms.sh
6. If this is a GI Home, as the root user execute:
***********************************************
/optware/grid/11.2.0.4/crs/install/rootcrs.pl -patch
APPLY PATCH TO DATABASE HOME =>
/optware/oracle/11.2.0.4/db_1
*****************************
Stop the CRS managed resources running
from DB homes. If this is a GI Home environment, as the database home owner
execute
==========================================================================================================================
/optware/oracle/11.2.0.4/db_1/bin/srvctl
stop home -o /optware/oracle/11.2.0.4/db_1 -s /optware/oracle/tmp/status.log -n
Servername
1.Run the pre script for DB component of
the patch. As the database home owner execute:
=======================================================================================
$///custom/server//custom/scripts/prepatch.sh
-dbhome
/optware/grid/11.2.0.4/PATCH/oct2018/28689170/28429134/27735020/custom/scripts/prepatch.sh
-dbhome /optware/oracle/11.2.0.4/db_1
2.Apply the OCW & DB PSU patch. As the
database home owner execute:
====================================================================
$/OPatch/opatch napply -oh -local
///custom/server/
/optware/oracle/11.2.0.4/db_1/OPatch/opatch
napply -oh /optware/oracle/11.2.0.4/db_1 -local /optware/grid/11.2.0.4/PATCH/oct2018/28689170/28429134/27735020/custom/server/27735020
$/OPatch/opatch apply -oh -local
//
/optware/oracle/11.2.0.4/db_1/OPatch/opatch
apply -oh /optware/oracle/11.2.0.4/db_1 -local
/optware/grid/11.2.0.4/PATCH/oct2018/28689170/28429134/28204707
3.Apply OJVM Patch. As the database home
owner execute:
======================================================
/optware/oracle/11.2.0.4/db_1/OPatch/opatch
apply -oh /optware/oracle/11.2.0.4/db_1 -local
/optware/grid/11.2.0.4/PATCH/oct2018/28689170/28440700
4.Run the post script for DB component of
the patch. As the database home owner execute:
========================================================================================
$///custom/server//custom/scripts/postpatch.sh
-dbhome
/optware/grid/11.2.0.4/PATCH/oct2018/28689170/28429134/27735020/custom/scripts/postpatch.sh
-dbhome /optware/oracle/11.2.0.4/db_1
5.START HOME
==========
/optware/oracle/11.2.0.4/db_1/bin/srvctl
start home -o /optware/oracle/11.2.0.4/db_1 -s /optware/oracle/tmp/status.log -n
Servername
Check for logs under /optware/grid/11.2.0.4/cfgtoollogs/
Basic check Pre & Post:
=======================
for i in `cat
/optware/oracle/admin/mig11204/db.dat`
do
. ~oracle/.profile.$i
sqlplus "/ as sysdba"
<<EOF
select name from v\$database;
set lines 300 pages 100 feed off
col comp_id for a10
col comp_name for a60
col version for a10
col status for a10
col ACTION_TIME for a40
col ACTION for a10
col namespace for a20
col version for a10
col comments for a30
select
a.name,comp_id,comp_name,version,status from dba_registry, v$database a;
select
a.name,ACTION_TIME,action,namespace,version,comments from
sys.registry$history, v$database a;
EOF
done
To Apply patch Manually: ( db.dat will contain name of all database. 1 db name per line )
=========================
Below is for oct2016 need to modify
for i in `cat
/optware/oracle/admin/mig11204/db.dat`
do
. ~oracle/.profile.$i
sqlplus "/ as sysdba" <>patching1.log
STARTUP UPGRADE
@$ORACLE_HOME/sqlpatch/27923163/postinstall.sql
SHUTDOWN immediate
STARTUP
@$ORACLE_HOME/rdbms/admin/catbundle.sql
psu apply
@$ORACLE_HOME/rdbms/admin/utlrp.sql
EOF
done
To start all database: ( db.dat will contain name of all database. 1 db name per line )
======================
for i in `cat
/optware/oracle/admin/mig11204/db.dat`
do
. ~oracle/.profile.$i
sqlplus "/ as sysdba"
<<EOF
startup
EOF
Done
Rollback Patch 29251270: OJVM PATCH SET UPDATE
11.2.0.4.190416
cd $ORACLE_HOME/OPatch
./opatch rollback -id 29251270
cd $ORACLE_HOME/sqlpatch/29251270
sqlplus /nolog
CONNECT / AS SYSDBA
STARTUP
alter system set cluster_database=false
scope=spfile;
SHUTDOWN
STARTUP UPGRADE
@postdeinstall.sql
alter system set cluster_database=true
scope=spfile;
SHUTDOWN
STARTUP
Rollback Patch 29141056: DATABASE PATCH SET UPDATE
11.2.0.4.190416
Shut down the instance on the node.
cd $ORACLE_HOME/OPatch
opatch rollback -id 29141056
Start all database instances running from
the Oracle home.
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
CONNECT / AS SYSDBA
STARTUP
@catbundle_PSU__ROLLBACK.sql
QUIT
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
CONNECT / AS SYSDBA
@utlrp.sql
Reference
RDBMSOnline Patching Aka Hot Patching [ID 761111.1]
Among the high availability features provided by 11g, Oracle introduced the Hot patching concept. Hot patching allows the DBA to install, enable, and disable a patch online without disruption to Oracle services. Hot patches don't require instance shutdown, and they are installed with the traditional OPatch tool. This tool can detect conflicts between hot patches.
Not all patches in 11g can be installed in Hot patch mode. First you must find out if the patch supports the hot patch apply feature. You can use the following command to determine if this mode is allowed
How to check if patch is online
opatch query -is_online_patch <PatchLocation>
Or
$ cd <PATCH_TOP>/10188727
$ opatch query -all online
Applying Patch
opatch apply online -connectString <SID>:<USERNAME>:<PASSWORD>:<NODE>
For RAC you can list all of the instances:
opatch apply online -connectString <SID>:<USERNAME>:<PASSWORD>:<NODE1>,<SID2>:<USERNAME>:<PASSWORD>:<NODE2>,...
To see patches installed in the ORACLE_HOME:
$ORACLE_HOME/OPatch/opatch lsinventory -details
How are Online Patches rollback'ed?
Using "opatch" you can rollback the patch
opatch rollback -id <patchID> -connectString <SID>:<USERNAME>:<PASSWORD>:<NODE1>,<SID2>:<USERNAME>:<PASSWORD>:<NODE2>, ...
The USERNAME and PASSWORD are those of a user that has SYSDBA privileges. The USERNAME and PASSWORD can be left blank if the OS user applying the patch has the SYSDBA privilege. Also the NODE is optional if the patch is being applied locally.
Using opatch does not remove the patch, it simply disables it (rolls it back) and removes the patch entry from the inventory. This behavior may change in the future.