How to apply OPATCH without downtime
As we know to apply Opatch we need to shutdown the database and
listener because OPATCH utility will update the current ORACLE_HOME
when you apply the patch. Thus in a single instance it is almost impossible to
apply the patch without downtime or zero downtime, here you can minimize the
downtime by applying the binaries, libraries in rolling manner but for upgrade
the database or catalog you will have to shut it down and open the database in
upgrade mode where as in RAC environment there will be possibly more separate ORACLE_HOME
and each ORACLE_HOME running with separate instance. You can
shutdown your current node and apply the patches then gradually move to apply
on another node.
OPATCH
napply -skip_subset -skip_duplicate -local -oh $ORACLE_HOME
When using local parameter and -oh $ORACLE_HOME that means this patch will only apply to the current ORACLE_HOME.
When using local parameter and -oh $ORACLE_HOME that means this patch will only apply to the current ORACLE_HOME.
Apply Opatch on single instance database (Need downtime)
– Check the status of database and invalid objects (if any)
Select dbid, name, open_mode, log_mode from
v$database;
SELECT owner, COUNT(*) FROM dba_objects
SELECT owner, COUNT(*) FROM dba_objects
WHERE status = 'INVALID' GROUP BY owner;
– Check Compatibility for opatch version
OPATCH –v
Note:
if opatch version
is not compatible check the readme file and download the latest version
and uncompress in ORACLE_HOME.
– Check orainst.loc file pointing to your
current ORACLE_HOME
Note: You must point the
inventory to the current (which is going to be patched) ORACLE_HOME (incase
when server having more than one ORACLE_HOME).
– Check free space on current ORACLE_HOME
– Now unzip the patch and go to the patch directory
– Then Stop the listener and database.
lsnrctl stop
Shutdown immediate;
– Copy the patch to the current ORACLE_HOME\Opatch\bin
path and then apply
Opatch napply -skip_subset
-skip_duplicate
Apply Opatch on RAC database
(Minimum downtime and without downtime)
In RAC database bring down one instance and listener and
apply the patch and open it
and then do the same on another node. In this way your database will be up for end users.
OPATCH napply -skip_subset -skip_duplicate -local -oh $ORACLE_HOME
Apply with Minimum downtime:
Shutdown the Oracle instance on node 1
Apply the patch to the Oracle instance on node 1
Shutdown the Oracle instance on node 2
Apply the patch to the Oracle instance on node 2
Shutdown the Oracle instance on node 3
At this point, instances on nodes 1 and 2 can be brought up
Apply the patch to the Oracle instance on node 3
Startup the Oracle instance on node 3
Apply Opatch with without downtime:
Shutdown the Oracle instance on node 1
Apply the patch to the Oracle instance on node 1
Start the Oracle instance on node 1
Shutdown the Oracle instance on node 2
Apply the patch to the Oracle instance on node 2
Start the Oracle instance on node 2
Shutdown the Oracle instance on node 3
Apply the patch to the Oracle instance on node 3
Start the Oracle instance on node 3
Check the below link for: Post Patch Steps
Finally confirm at db level the patch has been applied successfully or not
Select * from registry$history;and then do the same on another node. In this way your database will be up for end users.
OPATCH napply -skip_subset -skip_duplicate -local -oh $ORACLE_HOME
Apply with Minimum downtime:
Shutdown the Oracle instance on node 1
Apply the patch to the Oracle instance on node 1
Shutdown the Oracle instance on node 2
Apply the patch to the Oracle instance on node 2
Shutdown the Oracle instance on node 3
At this point, instances on nodes 1 and 2 can be brought up
Apply the patch to the Oracle instance on node 3
Startup the Oracle instance on node 3
Apply Opatch with without downtime:
Shutdown the Oracle instance on node 1
Apply the patch to the Oracle instance on node 1
Start the Oracle instance on node 1
Shutdown the Oracle instance on node 2
Apply the patch to the Oracle instance on node 2
Start the Oracle instance on node 2
Shutdown the Oracle instance on node 3
Apply the patch to the Oracle instance on node 3
Start the Oracle instance on node 3
Check the below link for: Post Patch Steps
Finally confirm at db level the patch has been applied successfully or not