Wednesday, February 27, 2019

How to Apply Oracle Latest patch set, OJVM and security patch...etc

When planning for Oracle patches make sure all pre-requisites are met and required backups are in place. Please refer below link to find out the required patches for 11g and 12c.

Oracle 11g and 12c Latest Database or OJVM Patch Set Update or Release Update

Pre-requisites

1. Before you apply patch make sure you are using latest Opatch version.

$./opatch version
OPatch Version: 11.2.0.3.19
OPatch succeeded.

Downloaded the latest opatch for 12.2 version using the link - https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=6880880

To apply latest Opatch follow the instructions
OPatch - Where Can I Find the Latest Version of OPatch(6880880)? [Video] (Doc ID 224346.1)


2. Download the required PSU or JVN or intern patch and unzip

3. Make sure there are no conflicts and run below script to find out the conflicts. If you see any conflicts the make sure you fix the reported conflicts.

$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./

In case of any conflicts you will see the message like below

There are no patches that can be applied now.
Following patches have conflicts. Please contact Oracle Support and get the merged patch of the patches :xxxxxxx, xxxxxx


In case if there are no conflicts then you will see the message like below

Invoking prereq "checkconflictagainstohwithdetail"
Prereq” CheckConflictAgainstOHWithDetail” passed.
Opatch Succeeded.


4. Using the -report option to simulate the application of the interim patch or PSU

Using “-report” option with "opatch apply" to simulate the apply without updating any files. Using this option you no need to shutdown the databases and it can be up and running.

$ opatch apply -report
...
Skip patching component oracle.rdbms, 11.2.0.4.0 and its actions.
The actions are reported here, but are not performed.

ApplySession skipping inventory update.

Verifying the update...
Inventory and System verification is performed here.
Patch xxxxxx successfully applied
Log file location: /oracle/product/11.2.0.4/cfgtoollogs/opatch/12834800_May_02_2019_10_27_17/apply2019-05-12_10-27-17AM_1.log

OPatch succeeded

5. Run utlrp.sql to recompile any invalid objects
$ORACLE_HOME/rdbms/admin/utlrp.sql

6. Check Oracle Components are VALID or not. Please make sure you fix INVALID component.
If NOT required then you might have to remove INVALID components.

SQL> select substr(comp_name,1,30) comp_name, substr(comp_id,1,10)
comp_id,substr(version,1,12) version,status from dba_registry; 
COMP_NAME                                                    COMP_ID              VERSION         STATUS
------------------------------------------------------------ -------------------- --------------- ----------
Oracle Multimedia                                            ORDIM                11.2.0.4.0      VALID
Oracle XML Database                                          XDB                  11.2.0.4.0      VALID
Oracle Expression Filter                                     EXF                  11.2.0.4.0      VALID
Oracle Rules Manager                                         RUL                  11.2.0.4.0      VALID
Oracle Workspace Manager                                     OWM                  11.2.0.4.0      VALID
Oracle Database Catalog Views                                CATALOG              11.2.0.4.0      VALID
Oracle Database Packages and T                               CATPROC              11.2.0.4.0      VALID
JServer JAVA Virtual Machine                                 JAVAVM               11.2.0.4.0      VALID
Oracle XDK                                                   XML                  11.2.0.4.0      VALID
Oracle Database Java Packages                                CATJAVA              11.2.0.4.0      VALID

7. Make sure you have taken TAR of the ORACLE_HOME, in case of any issues

tar -cvf oracle_home_12c.tar 12.2.0.1

Applying interim patch or PSU or JVM

1. Stop the databases and listener

Sqlplus / as sysdba
Shutdown immediate
$lsnrctl stop LISTENER

2. Make sure you are in the patch directory and run the below command to apply the patch

$cd <patch number>
$ORACLE_HOME/OPatch/opatch apply

3. Run post patch script against each database

Sqlplus /as sysdba
startup
@catbundle.sql psu apply
quit

Starting version 12.1 we need to use datapatch to complete post patch actions upon any 12c or later database restart. The datapatch contains the logic to identify if any post-patch SQL actions are pending.

Sqlplus / as sysdba
Startup upgrade

$ cd $ORACLE_HOME/Opatch
./datapatch -verbose

-verbose
Output additional information used for debugging

After datapatch restart the database.
Sqlplus / as sysdba
Shutdown immediate
startup

Post-verification:-
1. After patching check the inventory, to make sure patch has been updated or not
$ORACLE_HOME/OPatch/opatch lsinventory

Oracle Interim Patch Installer version 11.2.0.3.19
Copyright (c) 2019, Oracle Corporation. All rights reserved.

Oracle Home : /oracle/product/11.2.0/db_1
Central Inventory : /u01/app/oraInventory
from : /oracle/product/11.2.0/db_1/oraInst.loc
OPatch version : 11.2.0.3.19
OUI version : 11.2.0.4.0

Log file location : /oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2019-05-02_09-41-09AM_1.log
Lsinventory Output file location : /oracle/product/11.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2019-05-02_09-41-09AM.txt
……
OPatch succeeded.

2. Start the database and Listener, in case if they are still down

Sqlplus / as sysdba
startup

$lsnrctl start LISTENER

3. Run “utlrp.sql” to re-compile all invalid object

$ORACLE_HOME/rdbms/admin/utlrp.sql

4. Verify the patch history using from dba_registry_history using below query

SQL>select action_time,action from dba_registry_history;

ACTION_TIME ACTION

-------------------------------------------------- ------------------------------
02-MAY-19 06.35.23.191942 PM VIEW INVALIDATE
02-MAY-19 06.35.23.217686 PM UPGRADE
02-MAY-19 06.35.41.668820 PM APPLY

5. Please make sure all Oracle COMPONENTS are VALID

select substr(comp_name,1,30) comp_name, substr(comp_id,1,10)
comp_id,substr(version,1,12) version,status from dba_registry;

Thanks
Satishbabu Gunukula

1 comment:

  1. If you are interested in your favorite actors' birthday, please take a look at celeb networth database.

    ReplyDelete