Tuesday, 13 June 2017

Patch set update (PSU) apply to oracle db 11g using Opatch utility


NOTE: Always read "README.TXT" before applying any patch and always take ORACLE_HOME backup with root user.



1) check the database status:    

select name, open_mode, database_name, created, log_mode, platform_name from v$database;

NAME       OPEN_MODE            DATABASE_NAME       CREATED   LOG_MODE     PLATFORM_NAME
--------- -------------------- ------------------- --------- ------------ --------------------------------------------------
prod   READ WRITE           prod               09-JAN-17 NOARCHIVELOG  RHEL  (64-bit)

select COMP_NAME,VERSION,STATUS from dba_registry;
                                                    
COMP_NAME                              VERSION       STATUS
-------------------------------------- ------------- --------
OWB                                    11.2.0.3.0    VALID
Oracle Application Express             3.2.1.00.12   VALID
Oracle Enterprise Manager              11.2.0.3.0    VALID
OLAP Catalog                           11.2.0.3.0    VALID
Spatial                                11.2.0.3.0    VALID
Oracle Multimedia                      11.2.0.3.0    VALID
Oracle XML Database                    11.2.0.3.0    VALID
Oracle Text                            11.2.0.3.0    VALID
Oracle Expression Filter               11.2.0.3.0    VALID
Oracle Rules Manager                   11.2.0.3.0    VALID
Oracle Workspace Manager               11.2.0.3.0    VALID
Oracle Database Catalog Views          11.2.0.3.0    VALID
Oracle Database Packages and Types     11.2.0.3.0    VALID
JServer JAVA Virtual Machine           11.2.0.3.0    VALID
Oracle XDK                             11.2.0.3.0    VALID
Oracle Database Java Packages          11.2.0.3.0    VALID
OLAP Analytic Workspace                11.2.0.3.0    VALID
Oracle OLAP API                        11.2.0.3.0    VALID
                                      
18 rows selected.                     

2) Check the object's invalid:  

SELECT owner, COUNT(*) FROM dba_objects WHERE status = 'INVALID' GROUP BY owner;

OWNER                            COUNT(*)
------------------------------ ----------
SINU                                   1
VENKY                            5

3) Take backup of invalid's:    

create table bk_inv_ as select * from dba_objects where status='INVALID';

SQL> create table bk_inv_ as select * from dba_objects where status='INVALID';

Table created.


4) check opatch version using:   


$ opatch version
Invoking OPatch 11.2.0.1.7

OPatch Version: 11.2.0.1.7

OPatch succeeded.

** if opatch version is not compatible check the readme file and download the latest version and uncompress in $ORACLE_HOME.

$ opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.16
Copyright (c) 2017, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/11.2.0/db_1
Central Inventory : /u01/oraInventory
   from           : /u01/app/oracle/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.16
OUI version       : 11.2.0.3.0
Log file location : /u01/app/oracle/11.2.0/db_1/cfgtoollogs/opatch/opatch2017-06-09_20-23-29PM_1.log

Lsinventory Output file location : /u01/app/oracle/11.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2017-06-09_20-23-29PM.txt

--------------------------------------------------------------------------------
Local Machine Information::
Hostname: prod.viking
ARU platform id: 197
ARU platform description:: RHEL 

Installed Top-level Products (1):

Oracle Database 11g                                                  11.2.0.3.0
There are 1 products installed in this Oracle Home.


There are no Interim patches installed in this Oracle Home.


--------------------------------------------------------------------------------

OPatch succeeded.



5) check oraInst.loc file pointing to your current $ORACLE_HOME or not.
cat /etc/oraInst.loc
inventory_loc=/u01/app/oracle/11.2.0/db_1
inst_group=dba

if your server have more then one $ORACLE_HOME then comment the other $ORACLE_HOME and uncomment the current $ORACLE_HOME 
inventory must point to the current $ORACLE_HOME which is getting patched.


6) check free space on $ORACLE_HOME  :  df -h $ORACLE_HOME


7) check the utilities like

uname -p
uname -a
which ld
which ar
which make
etc as per readme file.


8) unzip the patch :       unzip -d /loc_2_unzip p.zip

9) Go the patch directory:      cd /loc_2_unzip/patch_number

10) Bring down the database & listner.

$ shut immediate
$ lsnrctl stop

11) export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH

12) Start the patch

$ cd <patch_directory>

$ /u01/app/oracle/11.2.0/db_1/OPatch/opatch apply

Oracle Interim Patch Installer version 11.2.0.3.16
Copyright (c) 2017, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/11.2.0/db_1
Central Inventory : /u01/oraInventory
   from           : /u01/app/oracle/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.16
OUI version       : 11.2.0.3.0
Log file location : /u01/app/oracle/11.2.0/db_1/cfgtoollogs/opatch/opatch2017-06-09_20-34-20PM_1.log

Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   13343438  13696216  13923374  14275605  14727310  16056266  16619892  16902043  17540582  18031683  18522512  19121548  19769496  20299017  20760997

Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name:

You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:  y



Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/oracle/11.2.0/db_1')


Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying sub-patch '13343438' to OH '/u01/app/oracle/11.2.0/db_1'

Patching component oracle.rdbms.rsf, 11.2.0.3.0...

Patching component oracle.rdbms, 11.2.0.3.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.3.0...
Applying sub-patch '13696216' to OH '/u01/app/oracle/11.2.0/db_1'

Patching component oracle.rdbms.rsf, 11.2.0.3.0...

Patching component oracle.rdbms, 11.2.0.3.0...

Patching component oracle.sdo.locator, 11.2.0.3.0...

Patching component oracle.sysman.console.db, 11.2.0.3.0...

Patching component oracle.sysman.oms.core, 10.2.0.4.4...
Applying sub-patch '13923374' to OH '/u01/app/oracle/11.2.0/db_1'
ApplySession: Optional component(s) [ oracle.network.cman, 11.2.0.3.0 ]  not present in the Oracle Home or                                                           a higher version is found.

Patching component oracle.rdbms.rsf, 11.2.0.3.0...

Patching component oracle.rdbms, 11.2.0.3.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.3.0...

Patching component oracle.network.rsf, 11.2.0.3.0...

Patching component oracle.network.listener, 11.2.0.3.0...

Patching component oracle.sysman.console.db, 11.2.0.3.0...
Applying sub-patch '14275605' to OH '/u01/app/oracle/11.2.0/db_1'
ApplySession: Optional component(s) [ oracle.precomp.lang, 11.2.0.3.0 ]  not present in the Oracle Home or                                                           a higher version is found.

Patching component oracle.network.client, 11.2.0.3.0...

Patching component oracle.network.rsf, 11.2.0.3.0...

Patching component oracle.precomp.common, 11.2.0.3.0...

Patching component oracle.rdbms, 11.2.0.3.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.3.0...

Patching component oracle.rdbms.rman, 11.2.0.3.0...

Patching component oracle.rdbms.rsf, 11.2.0.3.0...

Patching component oracle.rdbms.util, 11.2.0.3.0...
Applying sub-patch '14727310' to OH '/u01/app/oracle/11.2.0/db_1'

Patching component oracle.rdbms, 11.2.0.3.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.3.0...

Patching component oracle.rdbms.rsf, 11.2.0.3.0...

Patching component oracle.sdo.locator, 11.2.0.3.0...

Patching component oracle.sysman.console.db, 11.2.0.3.0...

Patching component oracle.sysman.oms.core, 10.2.0.4.4...
Applying sub-patch '16056266' to OH '/u01/app/oracle/11.2.0/db_1'
ApplySession: Optional component(s) [ oracle.network.cman, 11.2.0.3.0 ]  not present in the Oracle Home or                                                           a higher version is found.

Patching component oracle.network.listener, 11.2.0.3.0...

Patching component oracle.network.rsf, 11.2.0.3.0...

Patching component oracle.ovm, 11.2.0.3.0...

Patching component oracle.rdbms, 11.2.0.3.0...

Patching component oracle.rdbms.rman, 11.2.0.3.0...

Patching component oracle.rdbms.rsf, 11.2.0.3.0...

Patching component oracle.sdo.locator, 11.2.0.3.0...

Patching component oracle.rdbms.deconfig, 11.2.0.3.0...
Applying sub-patch '16619892' to OH '/u01/app/oracle/11.2.0/db_1'
ApplySession: Optional component(s) [ oracle.precomp.lang, 11.2.0.3.0 ]  not present in the Oracle Home or                                                           a higher version is found.

Patching component oracle.marvel, 11.2.0.3.0...

Patching component oracle.precomp.common, 11.2.0.3.0...

Patching component oracle.rdbms, 11.2.0.3.0...

Patching component oracle.rdbms.rman, 11.2.0.3.0...

Patching component oracle.rdbms.rsf, 11.2.0.3.0...

Patching component oracle.sysman.agent, 10.2.0.4.3...

Patching component oracle.sysman.console.db, 11.2.0.3.0...

Patching component oracle.sysman.repository.core, 10.2.0.4.4...

Patching component oracle.xdk, 11.2.0.3.0...

Patching component oracle.xdk.parser.java, 11.2.0.3.0...

Patching component oracle.xdk.rsf, 11.2.0.3.0...
Applying sub-patch '16902043' to OH '/u01/app/oracle/11.2.0/db_1'
ApplySession: Optional component(s) [ oracle.idm.oid, 11.2.0.3.0 ]  not present in the Oracle Home or a hig                                                          her version is found.

Patching component oracle.ldap.rsf, 11.2.0.3.0...

Patching component oracle.ldap.rsf.ic, 11.2.0.3.0...

Patching component oracle.owb.rsf, 11.2.0.3.0...

Patching component oracle.rdbms, 11.2.0.3.0...

Patching component oracle.rdbms.rsf, 11.2.0.3.0...

Patching component oracle.sysman.console.db, 11.2.0.3.0...
Applying sub-patch '17540582' to OH '/u01/app/oracle/11.2.0/db_1'
ApplySession: Optional component(s) [ oracle.precomp.lang, 11.2.0.3.0 ]  not present in the Oracle Home or                                                           a higher version is found.

Patching component oracle.rdbms, 11.2.0.3.0...

Patching component oracle.rdbms.rsf, 11.2.0.3.0...

Patching component oracle.sdo, 11.2.0.3.0...

Patching component oracle.ldap.rsf, 11.2.0.3.0...

Patching component oracle.precomp.common, 11.2.0.3.0...

Patching component oracle.ordim.client, 11.2.0.3.0...

Patching component oracle.rdbms.util, 11.2.0.3.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.3.0...

Patching component oracle.sdo.locator, 11.2.0.3.0...

Patching component oracle.rdbms.rman, 11.2.0.3.0...

Patching component oracle.ordim.jai, 11.2.0.3.0...
Applying sub-patch '18031683' to OH '/u01/app/oracle/11.2.0/db_1'
ApplySession: Optional component(s) [ oracle.precomp.lang, 11.2.0.3.0 ]  not present in the Oracle Home or                                                           a higher version is found.

Patching component oracle.ldap.rsf, 11.2.0.3.0...

Patching component oracle.precomp.common, 11.2.0.3.0...

Patching component oracle.rdbms.util, 11.2.0.3.0...

Patching component oracle.rdbms, 11.2.0.3.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.3.0...

Patching component oracle.rdbms.rsf, 11.2.0.3.0...

Patching component oracle.rdbms.rman, 11.2.0.3.0...
Applying sub-patch '18522512' to OH '/u01/app/oracle/11.2.0/db_1'

Patching component oracle.rdbms.rsf, 11.2.0.3.0...

Patching component oracle.rdbms, 11.2.0.3.0...

Patching component oracle.network.rsf, 11.2.0.3.0...

Patching component oracle.precomp.common, 11.2.0.3.0...

Patching component oracle.rdbms.rman, 11.2.0.3.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.3.0...
Applying sub-patch '19121548' to OH '/u01/app/oracle/11.2.0/db_1'

Patching component oracle.sysman.console.db, 11.2.0.3.0...

Patching component oracle.rdbms.rsf, 11.2.0.3.0...

Patching component oracle.rdbms.rman, 11.2.0.3.0...

Patching component oracle.rdbms, 11.2.0.3.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.3.0...

Patching component oracle.ordim.client, 11.2.0.3.0...

Patching component oracle.ordim.jai, 11.2.0.3.0...
Applying sub-patch '19769496' to OH '/u01/app/oracle/11.2.0/db_1'

Patching component oracle.sysman.agent, 10.2.0.4.3...

Patching component oracle.ovm, 11.2.0.3.0...

Patching component oracle.xdk, 11.2.0.3.0...

Patching component oracle.rdbms.util, 11.2.0.3.0...

Patching component oracle.rdbms, 11.2.0.3.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.3.0...

Patching component oracle.xdk.parser.java, 11.2.0.3.0...

Patching component oracle.oraolap, 11.2.0.3.0...

Patching component oracle.rdbms.rsf, 11.2.0.3.0...

Patching component oracle.xdk.rsf, 11.2.0.3.0...
Applying sub-patch '20299017' to OH '/u01/app/oracle/11.2.0/db_1'

Patching component oracle.xdk.parser.java, 11.2.0.3.0...

Patching component oracle.sysman.agent, 10.2.0.4.3...

Patching component oracle.xdk.rsf, 11.2.0.3.0...

Patching component oracle.rdbms.rsf, 11.2.0.3.0...

Patching component oracle.xdk, 11.2.0.3.0...

Patching component oracle.rdbms, 11.2.0.3.0...
Applying sub-patch '20760997' to OH '/u01/app/oracle/11.2.0/db_1'

Patching component oracle.sysman.console.db, 11.2.0.3.0...

Patching component oracle.rdbms, 11.2.0.3.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.3.0...
Composite patch 20760997 successfully applied.
Log file location: /u01/app/oracle/11.2.0/db_1/cfgtoollogs/opatch/opatch2017-06-09_20-34-20PM_1.log

OPatch succeeded.
$
$
$
$ opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.16
Copyright (c) 2017, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/11.2.0/db_1
Central Inventory : /u01/oraInventory
   from           : /u01/app/oracle/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.16
OUI version       : 11.2.0.3.0
Log file location : /u01/app/oracle/11.2.0/db_1/cfgtoollogs/opatch/opatch2017-06-09_20-44-55PM_1.log

Lsinventory Output file location : /u01/app/oracle/11.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2017-06-09_20-44-55PM.txt

--------------------------------------------------------------------------------
Local Machine Information::
Hostname: prod.viking
ARU platform id: 197
ARU platform description:: RHEL 

Installed Top-level Products (1):

Oracle Database 11g                                                  11.2.0.3.0
There are 1 products installed in this Oracle Home.


Interim patches (1) :

Patch  20760997     : applied on Fri JAN 09 20:40:15 IST 2017
Unique Patch ID:  18926826
Patch description:  "Database Patch Set Update : 11.2.0.3.15 (20760997)"
   Created on 11 JAN 2015, 09:33:38 hrs PST8PDT
Sub-patch  20299017; "Database Patch Set Update : 11.2.0.3.14 (20299017)"
Sub-patch  19769496; "Database Patch Set Update : 11.2.0.3.13 (19769496)"
Sub-patch  19121548; "Database Patch Set Update : 11.2.0.3.12 (19121548)"
Sub-patch  18522512; "Database Patch Set Update : 11.2.0.3.11 (18522512)"
Sub-patch  18031683; "Database Patch Set Update : 11.2.0.3.10 (18031683)"
Sub-patch  17540582; "Database Patch Set Update : 11.2.0.3.9 (17540582)"
Sub-patch  16902043; "Database Patch Set Update : 11.2.0.3.8 (16902043)"
Sub-patch  16619892; "Database Patch Set Update : 11.2.0.3.7 (16619892)"
Sub-patch  16056266; "Database Patch Set Update : 11.2.0.3.6 (16056266)"
Sub-patch  14727310; "Database Patch Set Update : 11.2.0.3.5 (14727310)"
Sub-patch  14275605; "Database Patch Set Update : 11.2.0.3.4 (14275605)"
Sub-patch  13923374; "Database Patch Set Update : 11.2.0.3.3 (13923374)"
Sub-patch  13696216; "Database Patch Set Update : 11.2.0.3.2 (13696216)"
Sub-patch  13343438; "Database Patch Set Update : 11.2.0.3.1 (13343438)"
   Bugs fixed:
     18681866, 13931044, 14318397, 19517437, 20134036, 20134035, 16279211

 
( you will get list of bug fixes by patch set update)

--------------------------------------------------------------------------------

OPatch succeeded.

13) start the listener & database:   

$ lsnrctl start
$ startup

14) Execute catbundle.sql & any bug fix packages mention in "README.TXT" of patchset

SQL> @catbundle.sql psu apply

PL/SQL procedure successfully completed.

15) Crosscheck the status of Database, dba_registry, listener & Invalid Objects.


Enjoy... :)



No comments:

Post a Comment