Você está na página 1de 6

PATCHING

http://fatdba.com/2013/03/29/what-and-whycatbundle-sql/
https://learnwithme11g.wordpress.com/tag/catbun
dle-sql/

Patch is a program (set of instructions)to fix a particular


problem/enhance/add a feature in an existing product/program/software.

Why patching is required?


Security
Stability
consistency
Unauthorized access

Types of patches
1) Patchset : A group of patches form a patch set. Patchsets are
applied by invoking OUI (Oracle Universal Installer) . Patchsets are
generally applied for Upgradation purpose . This results in a version
change for our Oracle software, for example, from Oracle Database
11.2.0.1.0 to Oracle Database 11.2.0.3.0.

2) Patchset Updates : Patch Set Updates are proactive cumulative


patches containing recommended bug fixes that are released on a regular
and predictable schedule . Oracle has catergaries as :

I.

Critical Patch Update (CPU) now refers to the overall release of


security fixes each quarter rather than the cumulative database
security patch for the quarter. Think of the CPU as the
overarching quarterly release and not as a single patch .

II. Patch Set Updates (PSU) are the same cumulative patches that
include both the security fixes and priority fixes. The key with PSUs
is they are minor version upgrades (e.g., 11.2.0.1.1 to 11.2.0.1.2).
Once a PSU is applied, only PSUs can be applied in future
quarters until the database is upgraded to a new base version.
III. Security Patch Update (SPU) terminology is introduced in the
October 2012 Critical Patch Update as the term for the quarterly
security patch. SPU patches are the same as previous CPU patches,
just a new name . For the database, SPUs can not be applied once
PSUs have been applied until the database is upgraded to a new
base version.
IV. Bundle Patches are the quarterly patches for Windows and Exadata
which include both the quarterly security patches as well as
recommended fixes.

PSUs(PatchSet Updates) or CPUs(Critical Patch Updates) ,SPU are applied via


opatch utility.

Here are steps for applying patches on linux Platform :

1) Download the required Patches from My Oracle Support (MOS):


https://support.oracle.com/
Login to metalink.
Click "Patches & Updates" link on top menu.

On the patch search section enter patch number and select the platform of
your database.
Click search.
On the search results page, download the zip file.

2) Opatch version and DB version:


SQL> select * from v$version; --DB version
$ file /bin/ls -- Linux version
opacth utility version >= Database version
if opatch version is not compatible check the readme file and download the
latest version and uncompress in $ORACLE_HOME. Oracle recommends that
we use the latest released OPatch , which is available for download
from My Oracle Support . OPatch is compatible only with the version of
Oracle Universal Installer that is installed in the Oracle home. We can
get all Opatch command by using Opatch help command .
$ export PATH=$ORACLE_HOME/OPatch:$PATH
To get the installed patches information
$opatch lsinventory
// It reads
$ORACLE_HOME/ContentsXML/comps.xml

3) Stop all the Oracle services:


Before applying Optach , make sure all the Oracle services including listener
are down . If they are not down then stop/down the oracle related Services.
Let's crosscheck it
Sql> Shutdown immediate
$ lsnrctl stop
$ ps -ef |grep pmon
oracle 15871 15484 0 11:20 pts/2

00:00:00 grep pmon

$ ps -ef |grep tns


oracle 15874 15484 0 11:20 pts/2

00:00:00 grep tns

4) Check Conflicts:
Run the following command to check whether there are any conflicts among
the patches to be applied, which will check if there are any conflicts among
the patches to be applied, by giving out the detailed information about the
conflicts/supersets:
opatch prereq CheckConflictAgainstOHWithDetail
-phBaseDir ./12827726
If result is passed and succeeded then there is no conflict.

5) Take Cold Backup:


It is highly recommended to backup the software directory which we
are patching before performing any patch operation. This applies to
Oracle Database or Oracle Grid Infrastructure software installation
directories. Take the backup of following
Take the Oracle software directory backup
$ tar -zcvf /u01/app/oracle/product/11.2.0/ohsw-bkp-b4-ptch.tar.gz
/u01/app/oracle/product/11.2.0

Take backup of oracle database.


$ tar -zcvf /u01/app/oracle/oradata/dbfl-b4-ptch.tar.gz
/u01/app/oracle/oradata
Here all the database files are in oradata directory .

Take backup of OraInventary


$ tar -zcvf /u01/app/oraInventary/orinv-b4-ptch.tar.gz
/u01/app/oraInventary

6) Check Invalid Objects:


Sql>select count (*) from dba_objects where status=INVALID;

7) Apply OPatches:
Set our current directory to the directory where the patch is located and then
run the OPatch utility by entering the following commands:
$ export PATH=$ORACLE_HOME/OPatch:$PATH:

$ opatch apply

or $ opatch napply -skip_subset -skip_duplicate

8) Post Installation:
Once, the Opatch installation completed successfully. Perform the post
Installation steps . Startup the oracle database with new patched
software and run catbundle.sql scripts which is found in
$ORACLE_HOME/rdbms/admin directory .
sql> @catbundle.sql cpu apply (or run
'@?/rdbms/admin/catbundle.sql cpu apply' )
sql> @catbundle.sql psu apply (or run
'@?/rdbms/admin/catbundle.sql psu apply' )

The catbundle.sql execution is reflected in the dba_registry_history view by a


row associated with bundle series PSU.
After upgrading the software upgrade the data dictionary of database.

(Check Readme.txt file and run the post patching scripts)

Start the database in upgrade mode and run catupgrd.sql script


Sql>startup upgrade;
Sql>@$ORACLE_HOME/rdbms/admin/catupgrd.sql
Find invalid db object and recompile them using utlrp.sql script
Sql>select count (*) from dba_objects where status=INVALID;
To compile
Sql>@$ORACLE_HOME/rdbms/admin/utlrp.sql;
9) Finally check the status of patch status:
We can check the final status of applied patched new Oracle Home by using
the below command .
SQL > select *
desc ;

from dba_registry_history

order by action_time

$ opatch lsinventory|grep 13343244

Notes :
i) If we are using a Data Guard Physical Standby database, we must install
this patch on both the primary database and the physical standby
database .

ii.) While applying patching take care of mount point status .There should be
sufficient Space .

Você também pode gostar