Thursday 30 March 2017

Step By Step applying a database patch to your Database Environment...

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
=======

$ 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 nor? 

$ ./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> 

No comments:

Post a Comment