Monday 5 December 2016

How to apply Database Patches in oracle


Hi Friends,

How to apply patches on Oracle Database environments, its very important and useful also. So, I am damn sure that every DBA must know it. I can say here, this may not useful for experience people but this is very very important for every beginners or freshers. Please find the below details and steps for applying patches on oracle database.

Step 1
Download the database patch from www.metalink.oracle.com
 

Our OS and Oracle Database environments are:
OS: Linux-x86-64bit 5.5
Database: Oracle Database 10g release 2 (10.2.0.1.0)


Download the patch according to your environment
So, Here our database patch is p4612267_10201_LINUX.zip for example.

Now, Check the Pre-install number of invalid Objects from below query:

SQL> select object_name,object_type,owner from dba_objects where status='INVALID';

no rows selected

SQL>

Step2 :
FTP to your test/production server.
Note: Best practice is fist always apply or test any Patch in Test Environment.
 

Now,after unzipping the patch, you will get one seven digit folder. Then change the permission to the patch folder like below:
Syntax: 
$unzip patch_name.zip

$ unzip p4612267_10201_LINUX.zip
Archive:  p4612267_10201_LINUX.zip
   creating: 4612267/
   creating: 4612267/files/
   creating: 4612267/files/lib/
   creating: 4612267/files/lib/libcore10.a/
  inflating: 4612267/files/lib/libcore10.a/sltrg.o
   creating: 4612267/etc/
   creating: 4612267/etc/config/
  inflating: 4612267/etc/config/inventory
  inflating: 4612267/etc/config/actions
   creating: 4612267/etc/xml/
  inflating: 4612267/etc/xml/GenericActions.xml
  inflating: 4612267/etc/xml/ShiphomeDirectoryStructure.xml
  inflating: 4612267/README.txt
$ pwd
/u01/patch
$ ls
4612267  p4612267_10201_LINUX.zip


$chmod 755 4612267
$chmod -R 755 4612267


step3* Check the Opatch version like below:

$ pwd
/u01/oracle/product/10.2.0/db_1/OPatch
$ ./opatch version
Invoking OPatch 10.2.0.1.0

OPatch Version: 10.2.0.1.0


OPatch succeeded.
$

Checking the patch has already been installed or not?

$ ./opatch lsinventory
Invoking OPatch 10.2.0.1.0

Oracle interim Patch Installer version 10.2.0.1.0
Copyright (c) 2005, Oracle Corporation.  All rights reserved..


Oracle Home       : /u01/oracle/product/10.2.0/db_1
Central Inventory : /u01/oracle/oraInventory
   from           : /u01/oracle/product/10.2.0/db_1/oraInst.loc
OPatch version    : 10.2.0.1.0
OUI version       : 10.2.0.1.0
OUI location      : /u01/oracle/product/10.2.0/db_1/oui
Log file location : /u01/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch-30                       

                                                                         _Sep_20_13-38-49-GMT

+05_Tue.log

Lsinventory Output file location : /u01/oracle/product/10.2.0/db_1/cfgtoollogs/o                       

                                                                         patch/lsinv/lsinventory-

30_Sep_20_13-38-49-GMT+05_Tue.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1):

Oracle Database 10g                                                  10.2.0.1.0
There are 1 products installed in this Oracle Home.


There are no Interim patches installed in this Oracle Home.

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


OPatch succeeded.

$ pwd
/u01/oracle/product/10.2.0/db_1/OPatch
$

As in above output, we can see this patch is not in list.
So, proceeding for next step:

SQL> shutdown immediate 

Database closed.
Database dismounted.
ORACLE instance shut down.


SQL>
SQL> !lsnrctl stop LISTENER_NAME

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 27-SEP-2011 04:06:30

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=abc.oracle.com)(PORT=1521)))
The command completed successfully

 

Listener can be stop from below command also:

$lsnrcrl stop Listener_name


* To check listerner status:

$lsnrctl status listener_name

Step4:

Go to the patch directory:
 $ cd /u01
$ cd patch/

$ ls
4612267  p4612267_10201_Linux-x86-64.zip

$ pwd
/u01/patch

$ cd 4612267/

$ ls
etc  files  README.txt



Note: Must Read carefully readme.text or readme.html.

Then Apply the Patch from below command:

$ opatch apply
Invoking OPatch 10.2.0.1.0

Oracle interim Patch Installer version 10.2.0.1.0
Copyright (c) 2005, Oracle Corporation.  All rights reserved..


Oracle Home       : /u01/oracle/product/10.2.0/db_1
Central Inventory : /u01/oracle/oraInventory
   from           : /u01/oracle/product/10.2.0/db_1/oraInst.loc
OPatch version    : 10.2.0.1.0
OUI version       : 10.2.0.1.0
OUI location      : /u01/oracle/product/10.2.0/db_1/oui
Log file location : /u01/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch-30_Sep_26_07-38-17-GMT

+05_Mon.log

ApplySession applying interim patch '4612267' to OH '/u01/oracle/product/10.2.0/db_1'
Invoking fuser to check for active processes.
Invoking fuser on "/u01/oracle/product/10.2.0/db_1/bin/oracle"

OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only.


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

Is the local system ready for patching?

Do you want to proceed? [y|n]
y
User Responded with: Y
Backing up files and inventory (not for auto-rollback) for the Oracle Home
Backing up files affected by the patch '4612267' for restore. This might take a while...
Backing up files affected by the patch '4612267' for rollback. This might take a while...

Patching component oracle.oracore.rsf, 10.2.0.1.0...
Updating archive file "/u01/oracle/product/10.2.0/db_1/lib/libcore10.a"  with "lib/libcore10.a/sltrg.o"
Updating archive file "/u01/oracle/product/10.2.0/db_1/lib32/libcore10.a"  with

"lib32/libcore10.a/sltrg.o"

Patching component oracle.rdbms, 10.2.0.1.0...
Updating archive file "/u01/oracle/product/10.2.0/db_1/lib/libcore10.a"  with "lib/libcore10.a/sltrg.o"
Running make for target client_sharedlib
Running make for target client_sharedlib
Running make for target ioracle
ApplySession adding interim patch '4612267' to inventory

The local system has been patched and can be restarted.



OPatch succeeded.
$

It must be shows ad OPatch Succeeded as above output. If any error come, please check. or you can consult wither us or any other DBA.

Step 5 Now again Checking patch has been installed or not?

$ ./opatch lsinventory
Invoking OPatch 10.2.0.1.0

Oracle interim Patch Installer version 10.2.0.1.0
Copyright (c) 2005, Oracle Corporation.  All rights reserved..


Oracle Home       : /u01/oracle/product/10.2.0/db_1
Central Inventory : /u01/oracle/oraInventory
   from           : /u01/oracle/product/10.2.0/db_1/oraInst.loc
OPatch version    : 10.2.0.1.0
OUI version       : 10.2.0.1.0
OUI location      : /u01/oracle/product/10.2.0/db_1/oui
Log file location : /u01/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch-30_Sep_26_07-45-09-GMT

+05_Mon.log

Lsinventory Output file location :

/u01/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory-30_Sep_26_07-45-09-GMT+05_Mon.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1):

Oracle Database 10g                                                  10.2.0.1.0
There are 1 products installed in this Oracle Home.


Interim patches (1) :

Patch  4612267      : applied on Mon Sep 26 07:42:48 GMT+05:30 2011
   Created on 24 Jul 2007, 04:27:45 hrs US/Pacific
   Bugs fixed:
     4612267


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


OPatch succeeded.
$

Post installation:

* Check the again number of INVALID objects:

SQL> select object_name,object_type,owner from dba_objects where status='INVALID';

no rows selected

SQL>


 

Some more useful links:

ORACLE DATABASE

ORACLE APPS

APPS PATCHING

JOB TIPS

IMPORTANT SCRIPTS

Hope this may useful and helpful. For any doubt or suggestion please write to us either in comment box or contact us @ora-data.blogspot.com

Thanks.

12 comments:

  1. You are so awesome! I do not think I have read anything like this before.
    So nice to discover someone with some genuine thoughts on this issue.
    Seriously.. thank you for starting this up. This web
    site is something that is needed on the web, someone with a bit of originality!

    ReplyDelete
    Replies

    1. Dear User,

      Thank you very much for your appreciations...

      Regards,
      ora-data Team

      Delete
  2. Right here is the right site for anyone who really wants to understand this topic.
    You know a whole lot its almost hard to argue with you (not that I personally would want
    to?HaHa). You certainly put a brand new spin on a subject
    that's been written about for a long time. Great stuff, just excellent!

    ReplyDelete
    Replies
    1. Dear User,
      Thank you for your feedback.

      Regards,
      ora-data Team

      Delete
  3. I ѕeriοusly love your site.. Pleaѕant colors &
    theme. Did you devеlop this website yourself? Please reply
    bacҝ as I'm attempting to create my very own website and wouⅼd love to learn where you got this
    from or exactly what the theme is called. Tһanks!
    like it : Best Encryption Software Android Apρѕ & Nine Reasons Your Marketing Isn’t Hoԝ To Encrypt A Password Ϝor Freeing

    ReplyDelete
  4. Hi there all, here every person is sharing these kinds of
    experience, therefore it's good to read this web site, and I used to pay
    a visit this weblog all the time.

    ReplyDelete
    Replies

    1. Dear User,

      Thank you very much for your great feedback.

      Regards,
      ora-data Team

      Delete
  5. Hi there, every time i used to check web site posts here in the early hours in the daylight, for the reason that i
    enjoy to learn more and more.

    ReplyDelete
    Replies

    1. Dear User,

      Thank you very much for your feedback.

      Regards,
      ora-data Team

      Delete

  6. Dear User,

    I don't have anything like that...
    I read all the comments and approve it...

    Regards,
    ora-data Team

    ReplyDelete
  7. Great article, just what I needed.

    ReplyDelete
    Replies

    1. Dear User,

      Thank you very much for your feedback.
      Please subscribe us for new updates...

      Regards,
      ora-data Team

      Delete

Thank you for your comments and suggestions. It's good to talk you.