This chapter contains below points
·
what exactly is Opatch :
·
How to check the Opatch version :
·
How to know which version is the
correct version of Opatch for your RDBMS home :
·
How to get the latest version of
OPatch :
·
What is Oracle Database Inventory and
where it is located :
·
How to create Local Inventory :
·
Opatch help :
·
Applying single patch using opatch :
·
Rolling back a patch :
·
Applying bundle patches :
·
Query the inventory for patches
applied :
·
Opatch Log files :
·
Advanced Option for Opatch :
·
How to check Pre-requistics Patches
while applying Database Patch using opatch :
·
How to apply Database Patches with
Details :
·
How to Apply Critical Patch Update
(CPU) on RAC :
what exactly is
Opatch?
OPatch is a java based utility that allow the application
and rolling back of interim patches to an Oracle product. The program has
sub-commands that may take arguments. The program requires Java(JVM) to be
present on the current system. OPatch expects users to have commands such as
fuser, jar, ar and make on Unix platforms and jar on Windows platforms to be
available in their PATH.
Opatch Details—
How to check the Opatch version?
-bash-3.00$
./opatch version
Invoking
OPatch 10.2.0.3.0
OPatch
Version: 10.2.0.3.0
OPatch
succeeded
How to know which version is the correct
version of Opatch for your RDBMS home?
You can
verify whether the Opatch version for your RDBMS release is correct or not
using metalink note ID 357221.1.
This note ID
gives the copatibilities between OPatch version and RDBMS version.
How to get the latest version of OPatch?
You can
download the latest version of OPatch from metalink using following URL.
http://updates.oracle.com/download/6880880.html
In the release
dropdown you can select the OPatch release that you want to download based on
your RDBMS version. Please read the README.txt before applying the patch.
What is Oracle Database Inventory and
where it is located?
Oracle
Inventory is the location or the place where all the information about an
Oracle Home is stored and maintained. When ever we install an RDBMS Oracle
Home, a new inventory gets created. Applying any new patch to Oracle Home will
update the invnrtory for that Oracle Home and record the details for the patch
applied. This inventory is in the form of XML files.
The location
of inventory is defined in a file called oraInst.loc. The path for this file is
provided while installing Oracle Home. If we dont supply any path, the file
will be present at central location /etc/oraInst.loc. Also we can have a
central inventory if its not used by any other oracle installation. If the
central inventory is used by previous Oracle installation we can create local
inventory. The content of oraInst.loc file is as shown below
-bash-3.00$
cd $ORACLE_HOME
-bash-3.00$
cat oraInst.loc
inventory_loc=/slot/ems2029/appmgr/apps/tech_st/10.1.2/oraInventory
inst_group=ems2029
-bash-3.00$
Here
“inventory_loc” gives the location of Inventory directory where as inst_group
gives the name of the group which is the owner of this inventory.
How to create Local Inventory?
You can
create local inventory at any location while installing Oracle Home. You need
to use -invPtrLoc variable along with runInstaller command and give the
location of oraInst.loc. Otherwise the default path assumed for oraInst.loc is
/etc/oraInst.loc.
./runInstaller
-invPtrLoc /slot/ems2029/appmgr/apps/tech_st/10.1.2/oraInst.loc
After the
installation starts it will ask for location of oraInventory directory and
group which should own it. It will make entry of these into oraInst.loc file.
Having know
the above information about opatch, now we will move to details about using
opatch and various options available.
Opatch help
You can get
all the options using opatch -help
-bash-3.00$
./opatch -help
Invoking
OPatch 11.1.0.6.0
Oracle
Interim Patch Installer version 11.1.0.6.0
Copyright
(c) 2007, Oracle Corporation. All rights
reserved.
Usage:
opatch [ -help ] [ -r[eport] ] [ command ]
command :=
apply
lsinventory
prereq
query
rollback
util
version
<global_arguments>
:= -help Displays the help message
for the command.
-report Print the actions without executing.
example:
‘opatch
-help’
‘opatch
apply -help’
‘opatch
lsinventory -help’
‘opatch
prereq -help’
‘opatch
rollback -help’
‘opatch util
-help’
OPatch
succeeded.
You can get
specific help for any command of opatch using opatch <command> -help.
Example opatch apply -help.
Applying single patch using opatch
1. You MUST
read the Readme.txt file included in opatch file, look for any prereq. steps/
post installation steps or and DB related changes. Also, make sure that you
have the correct opatch version required by this patch.
2. Make sure
you have a good backup of database.
3. Make a
note of all Invalid objects in the database prior to the patch.
4. Shutdown
All the Oracle Processes running from that Oracle Home , including the Listener
and Database instance, Management agent etc.
5. You MUST
backup your oracle Home and Inventory
tar cvf –
$ORACLE_HOME $ORACLE_HOME/oraInventory | gzip >
Backup_Software_Version.tar.gz
6. Unzip the
patch in $ORACLE_HOME/patches
If you are
applying a single intrim patch to oracle home, then change the location to the
directory of that patch and then invoke following command.
Example if I
need to apply patch 6972343 to RDBMS Oracle Home
-bash-3.00$
cd 6972343
-bash-3.00$
pwd
/slot/ems2029/oracle/db/tech_st/11.1.0/patches/6972343
-bash-3.00$
ls
etc files
README.txt
$ORACLE_HOME/OPatch/opatch
apply
If you have
created local inventory then you need to give the correct path for local
inventory stored in oraInst.loc. If you have updated /etc/oraInst.loc with
correct location of your inventory, then above command will work, If not you
can give the correct location by giving local oraInst.loc file.
$ORACLE_HOME/OPatch/opatch
apply -invPtrLoc /slot/ems2029/oracle/db/tech_st/11.1.0/oraInst.loc
Remember
that when we are applying patch, patch number is NOT provided as an input to
opatch command. So we have to to be in the directory of patch since opatch will
pick the patch files from current directory.
Rolling back a patch
In case if a
patch did not fix the issue or if you has applied wrong patch to oracle home,
you can always rollback the patch using following comamnd.
opatch
rollback -id <Patch Number>
Applying bundle patches
Some times
if you have to apply bundle patch having many patches, example lets say you
want to a bundle patch 6778860 (
11.1.0.6 BUNDLED PATCH FOR EBS 11I)) containing many other patches to
RDBMS home, OPatch provides a facility to apply many patches to RDBMS home
using a single comamnd. Following command should be used for applying bundle
patches.
Download the
patch and extract the same. You will see many directories (one for each patch)
inside the main patch directory. Execute following command to apply all
patches.
$ORACLE_HOME/OPatch/opatch
util NApply -invPtrLoc /slot/ems2029/oracle/db/tech_st/11.1.0/oraInst.loc
NApply ->
Will apply all patches to RDBMS home.
You can also
use -phBaseDir to point to the directory where bundle patch is installed. So
you can run opatch command from any location
$ORACLE_HOME/OPatch/opatch
util NApply -phBaseDir /slot/ems2029/oracle/db/tech_st/11.1.0/patches/6778860
-invPtrLoc /slot/ems2029/oracle/db/tech_st/11.1.0/oraInst.loc
You can also
apply specific patches using NApply
opatch util
napply <patch_location> -id 1,2,3 -skip_subset -skip_duplicate
This will
apply patches 1, 2, and 3 which are under < the patch_location>
directory. OPatch will skip duplicate patches and subset patches (patches under
<patch_location> that are subsets of patches installed in the
ORACLE_HOME)
You can see
all the options for NApply using following help command.
$ORACLE_HOME/OPatch/opatch
util NApply -help
Query the inventory for patches applied
We can query
the inventory to check various components installed for database as well as to
check various patches applied to database. Use following command to get a
minimum information from inventory about patches applied and components
installed.
$ORACLE_HOME/OPatch/opatch
lsinventory -invPtrLoc /slot/ems2029/oracle/db/tech_st/11.1.0/oraInst.loc
Patch 5763576
: applied on Wed May 28 03:20:53 PDT 2008
Created on 6
Feb 2008, 02:26:04 hrs PST8PDT
Bugs fixed:
5763576
If you are
using central inventory then -invPtrLoc variable is not required.
You can also
get the detailed view of inventory using following command. In case of detail
information it gives which are the files that this patch have touched.
$ORACLE_HOME/OPatch/opatch
lsinventory -detail -invPtrLoc
/slot/ems2029/oracle/db/tech_st/11.1.0/oraInst.loc
Patch 6318357
: applied on Wed May 28 03:33:27 PDT 2008
Created on 4
Dec 2007, 22:02:16 hrs PST8PDT
Bugs fixed:
6318357
Files
Touched:
udjvmrm.sql
–> ORACLE_HOME/javavm/install/udjvmrm.sql
Patch
Location in Inventory:
/slot/ems2029/oracle/db/tech_st/11.1.0/inventory/oneoffs/6318357
Patch
Location in Storage area:
/slot/ems2029/oracle/db/tech_st/11.1.0/.patch_storage/6318357_Dec_4_2007_22_02_16
Which
options are installed in Oracle Home?
You can
check the options installed in RDBMS home using above command. The options
installed will be listed at the start of output.
Example:
$ORACLE_HOME/OPatch/opatch lsinventory -detail -invPtrLoc
/slot/ems2029/oracle/db/tech_st/11.1.0/oraInst.loc
The complete
output of this command can be seen at this location.
Opatch Log files
Log file for
Opatch utility can be found at $ORACLE_HOME/cfgtoollogs/opatch
How to check Pre-requistics Patches
while applying Database Patch using opatch
Lot of time
we apply Database patches using the opatch,It is mandatory to know the
Pre-requistics patches for applying the Patch.We can find it out with the below
steps.
Step 1:Go to
the Directory where patch is copied(PATCH TOP)
>cd
/home/oracle/patch/18308717
Step
2:Execute below command
>$ORACLE_HOME/OPatch/opatch
prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle
Interim Patch Installer version 11.2.0.3.6
Copyright
(c) 2013, Oracle Corporation. All rights
reserved.
PREREQ
session
Oracle
Home :
/u01/app/oracle/product/11.2.0.3/dbhome_1
Central
Inventory : /u01/app/oraInventory
from :
/u01/app/oracle/product/11.2.0.3/dbhome_1/oraInst.loc
OPatch
version : 11.2.0.3.6
OUI
version : 11.2.0.3.0
Log file
location :
/u01/app/oracle/product/11.2.0.3/dbhome_1/cfgtoollogs/opatch/opatch2014-07-24_17-52-50PM_1.log
Invoking
prereq "checkconflictagainstohwithdetail"
Prereq
"checkConflictAgainstOHWithDetail" passed.
OPatch
succeeded.
node1(TESTDB1) /home/oracle/patch/18308717
>ls -altr
total 24
-rw-rw-r-- 1
oracle oinstall 5905 May 14 03:35 README.txt
drwxr-xr-x 3
oracle oinstall 4096 May 14 03:35 files
drwxr-xr-x 4
oracle oinstall 4096 May 14 03:35 etc
drwxrw-rw- 3
oracle oinstall 4096 Jul 24 11:30 ..
drwxrwxr-x 4
oracle oinstall 4096 Jul 24 11:30 .
node1(TESTDB1) /home/oracle/patch/18308717
Step
3:Verify the Log
>vi
/u01/app/oracle/product/11.2.0.3/dbhome_1/cfgtoollogs/opatch/opatch2014-07-24_17-52-50PM_1.log
[Jul 24,
2014 5:52:50 PM] PREREQ session
[Jul 24,
2014 5:52:50 PM] OPatch invoked as
follows: 'prereq CheckConflictAgainstOHWithDetail -ph ./ -invPtrLoc
/u01/app/oracle/product/11.2.0.3/dbhome_1/oraInst.loc '
[Jul 24,
2014 5:52:50 PM] OUI-67077:
Oracle Home :
/u01/app/oracle/product/11.2.0.3/dbhome_1
Central Inventory
: /u01/app/oraInventory
from :
/u01/app/oracle/product/11.2.0.3/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.6
OUI version : 11.2.0.3.0
OUI location :
/u01/app/oracle/product/11.2.0.3/dbhome_1/oui
Log file location
: /u01/app/oracle/product/11.2.0.3/dbhome_1/cfgtoollogs/opatch/opatch2014-07-24_17-52-50PM_1.log
[Jul 24,
2014 5:52:50 PM] Patch history file:
/u01/app/oracle/product/11.2.0.3/dbhome_1/cfgtoollogs/opatch/opatch_history.txt
[Jul 24,
2014 5:52:50 PM] Invoking prereq
"checkconflictagainstohwithdetail"
[Jul 24,
2014 5:52:51 PM] Patch 18308717 is not
subset of any other patch processed till now
[Jul 24,
2014 5:52:51 PM] Patch ID 18308717
[Jul 24,
2014 5:52:51 PM] Patches that
conflict: [ ]
[Jul 24,
2014 5:52:51 PM] Checking conflicts
for patch: 18308717
[Jul 24,
2014 5:52:51 PM] Checking
conflicts/supersets for patch: 18308717 with patch:18308717
[Jul 24,
2014 5:52:51 PM] Checking
conflicts/supersets for patch: 18308717 with patch:17076717
[Jul 24, 2014
5:52:51 PM] Checking
conflicts/supersets for patch: 18308717 with patch:17296419
[Jul 24,
2014 5:52:51 PM] Checking
conflicts/supersets for patch: 18308717 with patch:16475860
[Jul 24,
2014 5:52:51 PM] Prereq
"checkConflictAgainstOHWithDetail" passed.
[Jul 24,
2014 5:52:51 PM] Finishing
PrereqSession at Thu Jul 24 17:52:51 IST 2014
Message:Patch
18308717 is not subset of any other patch processed till now
From the
above logs we can confirm that there are no-prerequistics patches to be applied
before applying 18308717.
How to apply Database Patches
Database
patches are of various kinds like,But in broad there are II types:
I)Patchset:
To upgrade to higher version we use Database patchset.i.e For Upgrading from
10.2.0.1.0 to 10.2.0.4.0 we have to use Patchset.
II)Patchset
Updates:
Patchset
Updates are mainly divided into two types:
1)CPU(Critical
Patch Update): Critical Patch Update, quarterly delivered by Oracle to fix
security issues.
2)PSU(Patch
Set Update): PatchSet Update, also quarterly delivered by Oracle,it includes
CPU and a bunch of other one-off patches.
PSUs have
been introduced for the first time on Oct-2009,We can use them, and stop to
apply CPUs. PSUs, as CPUs, are cumulatives, no need to apply all of them, just
apply the last one should be enough. One-off patch is single fix, to fix a
particular issue.
We need to
have metalink(My Oracle Support)Account to download this patch and applying
instructions will be there in readme file of Patch.
1)How to apply Patchsets:
Patchsets
are applied via OUI(Oracle Universal Installer).Patchsets are usually applied
to upgrade oracle version Eg: When we want to upgrade from Base release
10.2.0.1.0 to 10.2.0.4.0 for more useful feature and to avoid bugs,We have to
use Patchset 10.2.0.4.0.So Patchsets change the version number.
Details of
this process is there in the below mentioned link:
2)How to apply Patch set updates or
Critical Patch Updates:
PSUs(PatchSet
Updates) or CPUs(Critical Patch Updates)are applied via opatch utility.
opatch is an
interim utility for applying Database interim patches which will fix the bug in
the release. For making use of the opatch utility you have to download the
opatch recent version and apply as follow:
Downloading and installing the latesh
Opatch version:
Below are
the steps for downloading and installing the latest opatch version.opatch is
very much useful for applying the database patches to fix various bugs and it
is very much important to have the latest version.
1) Please
download the latest OPatch version from My Oracle Support (MOS)
a) Click on
the "Patches & Updates" tab
b) In the
"Patch Name or Number" field type 6880880
c) In the
"Platform" field select the relevant platform
d) Click the
Search button.
e) Select
the patch that corresponds to the Oracle release installed: 6880880 Universal Installer: Patch OPatch
11.2
f) Click the
Download button
Once the
above task is done copy the patch to $ORACLE_HOME directory and move the
previous OPatch directory to separate directory in OS.We can use winscp or ftp
for copying this patch from MOS to windows andthan windows to linux server.
Now,unzip
this patch zip file.The files will be extracting as shown below:
Eg:
-----
$ cd
$ORACLE_HOME
(If an
OPatch directory already exist then move it)
$ mv Opatch
/TEST/OPatch_100057
$cd
$ORACLE_HOME
$ unzip
p6880880_101000_LINUX64.zip
Archive:
p6880880_101000_LINUX64.zip
creating:
OPatch/
creating:
OPatch/docs/
inflating:
OPatch/docs/FAQ
inflating:
OPatch/docs/README.txt
inflating:
OPatch/docs/Users_Guide.txt
inflating:
OPatch/docs/bt1.txt
inflating:
OPatch/docs/bt2.txt
inflating:
OPatch/docs/tmp
inflating:
OPatch/emdpatch.pl
creating:
OPatch/jlib/
inflating:
OPatch/jlib/opatch.jar
inflating:
OPatch/opatch
inflating:
OPatch/opatch.bat
inflating:
OPatch/opatch.pl
[oracle@kor300949lx1
OPatch]$ opatch version
Invoking
OPatch 11.2.0.1.5
OPatch
Version: 11.2.0.1.5
OPatch
succeeded.
[oracle@kor300949lx1
OPatch]$ opatch apply /u01/app/8264365
Invoking
OPatch 11.2.0.1.5
Oracle
Interim Patch Installer version 11.2.0.1.5
Copyright
(c) 2010, Oracle Corporation. All rights reserved.
Oracle Home
: /u01/app/oracle/product/11.1.0/db_1
Central
Inventory : /u01/app/oraInventory
from :
/etc/oraInst.loc
OPatch
version : 11.2.0.1.5
OUI version
: 11.2.0.1.0
OUI location
: /u01/app/oracle/product/11.1.0/db_1/oui
Log file
location :
/u01/app/oracle/product/11.1.0/db_1/cfgtoollogs/opatch/opatch2011-05-16_17-18-01PM.log
Patch
history file: /u01/app/oracle/product/11.1.0/db_1/cfgtoollogs/opatch/opatch_history.txt
Here is your
opatch latest version ready,Let us what all it consists of:
Go to the
below mentioned path for all opatch commands description.
$ cd
$ORACLE_HOME/OPatch/docs/
$ vi Users_Guide.txt
In general
for applying any patch,We have to use the below command:
$cd
$ORACLE_HOME/OPatch
$opatch
apply /u01/Patch_dir/
Where :/u01/Patch_dir: The path where you have kept your
Patch in the OS.
.
Applying CPU Patche
"CPUJULY2011" for 10.2.0.4 Database on LINUX
Note:
Before
continue the following step please read the README file from the patch.
Critical
patch update (CPU) patches are cumulative, which means fixes from previous
Oracle security alerts and critical patch updates are included.
It is not required
to have previous security patches applied before applying the CPUJul2011
patches. However, you must be on the stated patch set level for a given product
home before applying the CPUJul2011 patches for that release.
The Critical
Patch Update (CPU) patches are rolling up gradation,
Do one of
the following, depending on whether this is a RAC environment:
If this is a
RAC environment, choose one of the patch installation methods provided by
OPatch (rolling, all node, or minimum downtime), and shutdown instances and
listeners as appropriate for the installation method selected.
This CPU
patch is rolling RAC installable, Please refer to My Oracle Support Note
244241.1.
If this is
not a RAC environment, shut down all instances and listeners associated with
the Oracle home that you are updating.
Step by step
CPU patches Applying:
If you are
wish to applying rolling CPU patch on RAC, then the following steps must be
following.
Rolling
patch (no downtime)
-Shutdown
the Oracle instance on node 1
-Apply the
patch to the RAC home on node 1
-Start the
Oracle instance on node 1
-Shutdown
the Oracle instance on node 2
-Apply the
patch to the RAC home on node 2
-Start the
Oracle instance on node 2
-Shutdown
the Oracle instance on node 3
-Apply the
patch to the RAC home on node 3
-Start the
Oracle instance on node 3
1.Download
the CPU patch p12419249_10204_Linux-x86 from Metalink.
2.Change the
owner of the patch file to oracle user.
# chown –R
oracle: install p12419249_10204_Linux-x86.zip
3.Set the
PATH variable to locate the opatch utility.
$ export
PATH=$PATH: $ORACLE_HOME/OPatch
4.unzip the
patch and go the unzipped directory
$unzip
p12419249_10204_Linux-x86.zip
5.Fine the
Opatch version
$ opatch
version
Invoking
OPatch 10.2.0.4.2
OPatch
Version: 10.2.0.4.2
$ opatch
lsinventory
Note: if you
want check the CPU patch is whether rolling support or not, follow the steps.
-go to the
patch directory
Cd
/oracle/12419249
[oracle@rac1
12419249]$ opatch query -all
Invoking
OPatch 10.2.0.4.2
Oracle
Interim Patch Installer version 10.2.0.4.2
Copyright
(c) 2007, Oracle Corporation. All rights
reserved.
Oracle
Home :
/oracle/product/10.2.0/rdbms
Central
Inventory :
/oracle/product/10.2.0/oraInventory
from : /etc/oraInst.loc
OPatch
version : 10.2.0.4.2
OUI
version : 10.2.0.4.0
OUI
location :
/oracle/product/10.2.0/rdbms/oui
Log file
location :
/oracle/product/10.2.0/rdbms/cfgtoollogs/opatch/opatch2011-05-01_08-55-20AM.log
--------------------------------------------------------------------------------
Patch
created on 20 May 2011, 03:02:21 hrs PST8PDT
Need to
shutdown Oracle instances: false
(<--hear false mean we no need to down the database)
Patch is roll-backable: true
Patch is a rolling patch: true
Patch has sql related actions: false
Patch is an online patch: false
Patch is a portal patch: false
List of platforms supported:
46: Linux Intel
List of bugs to be fixed:
8534387: CPUJUL2009 DATABASE 10.2.0.4
8290506: CPUAPR2009 DATABASE 10.2.0.4
7375644: MLR BUG FOR 10.2.0.4 FOR CPUOCT2008
9352191: CPUAPR2010 DATABASE 10.2.0.4
9655017: CPUJUL2010 DATABASE 10.2.0.4
7150470: MLR BUG FOR 10.2.0.4 FOR CPUJUL2008
7592346: CPUJAN2009 DATABASE 10.2.0.4
9952272: CPUOCT2010 DATABASE 10.2.0.4
9119226: CPUJAN2010 DATABASE 10.2.0.4
11725015: CPUAPR2011 DATABASE 10.2.0.4
12419249: CPUJUL2011 DATABASE 10.2.0.4
8836308: CPUOCT2009 DATABASE 10.2.0.4
10249540: CPUJAN2011 DATABASE 10.2.0.4
List of optional components:
oracle.rdbms.rsf :
10.2.0.4.0
oracle.rdbms :
10.2.0.4.0
6.Backup the
oraInventory and Opatch directory
$cp -R
oraInventory old_oraInventory
$cp -R
opatch old_opatch
7.If you are
Applying on RAC, follow the below steps:
Shut down
the instance one of node
$ srvctl
stop instance -d racdb –i racdb1
Shut down
the ASM instanc respected node
$ srvctl
stop asm -n rac1
Shut down
all Nodeapps services of the node
$ srvctl
stop ndoeapps -n rac1
8.Go to the Patch
Directory and invoke opatch apply.
$ cd
12419249
$opatch
apply or $opatch napply -skip_subset -skip_duplicate
9.Verify
Patches are applied
$opatch
lsinventory -detail -oh $ORACLE_HOME
10.Now start
the Node1 and repeat the same 1 to 10 steps on Node2
$ srvctl
start nodeapps –n rac1
$srvctl
start asm –n rac1
$srvctl
start instance –d racdb –i racdb1
Note: if the
database on rac1 located, now relocate to node2
$
crs_relocate ora.racdb.db
11.Now stop
Instance,asm and nodeapps on node2
$ srvctl
stop instance –d racdb –i racdb2
$ srvctl
stop asm –n rac2
$ srvctl
stop nodeapps –n rac2
12.Go to the
Patch Direcotry and invoke the opatch apply on node2
$ cd
12419249
$ opatch
apply or opatch napply -skip_subset -skip_duplicate
13.Verify Patches are applied
$opatch lsinventory -detail -oh
$ORACLE_HOME
14.Start
the Instance,Asm and Nodeapps on node2
$srvctl
start instance –d racdb –i racdb2
$srvctl
start asm –n rac2
$srvctl
start nodeapps –n rac2
$crs_stat –t
Post CPU
installation Steps:
For each
database instance running on the Oracle home being patched, connect to the
database using SQL*Plus on each node.
Connect as
SYSDBA and run the catbundle.sql script as follows:
On node1 and
node2:
cd
$ORACLE_HOME/rdbms/admin
sqlplus
/nolog
SQL>
CONNECT / AS SYSDBA
SQL>
STARTUP
SQL>
@catbundle.sql cpu apply
SQL>
@utlrp.sql
SQL> QUIT
The
catbundle.sql execution is reflected in the dba_registry_history view by a row
associated with bundle series CPU.
For
information about the catbundle.sql script, see My Oracle Support Note 605795.1
Introduction to Oracle Database catbundle.sql.
Check the
following log files in $ORACLE_HOME/cfgtoollogs/catbundle for any errors:
catbundle_CPU__APPLY_.log
catbundle_CPU__GENERATE_.log
Recompiling
Views in the Database
You may skip
this section if you have recompiled views for this database during the
installation of a previous CPU.
The time
required to recompile the views and related objects depends on the total number
of objects and on your system configuration.
In one
internal Oracle test with approximately 2000 views and 4000 objects, the total
execution time for view_recompile_jan2008cpu.sql and utlrp.sql was about 30
minutes.
If you want
to check whether view recompilation has already been performed for the
database, execute the following statement.
SELECT *
FROM registry$history where ID = '6452863';
If the view
recompilation has been performed, this statement returns one or more rows. If
the view recompilation has not been performed, this statement returns no rows.
If no rows returns then go the following steps.
The
following steps recompile the views in the database. For a RAC environment,
perform these steps on only one node.
1. Run the
pre-check script (so named because it was initially released in CPUJan2008),
which reports the maximum number of views and objects that may be recompiled:
cd
$ORACLE_HOME/cpu/view_recompile
sqlplus
/nolog
SQL>
CONNECT / AS SYSDBA
SQL>
@recompile_precheck_jan2008cpu.sql
SQL> QUIT
The purpose
of this step is to help you determine whether view recompilation should be done
at the same time as the CPU install, or scheduled later.
Note:
If the
database is not in a RAC environment(if Single Instance), perform this step and
skip the next step 2. (If the database is in a RAC environment, go to the next
step2.)
Run the view
recompilation script, note that this script is run with the database in upgrade
mode, which restricts connections as SYSDBA.
cd
$ORACLE_HOME/cpu/view_recompile
sqlplus
/nolog
SQL>
CONNECT / AS SYSDBA
SQL>
SHUTDOWN IMMEDIATE
SQL> STARTUP
UPGRADE
SQL>
@view_recompile_jan2008cpu.sql
SQL>
SHUTDOWN;
SQL>
STARTUP;
SQL> QUIT
2.If the
database is in a RAC environment, run the view recompilation script as follows,
note that this script is run with the database in upgrade mode, which restricts
connections as SYSDBA. Stop all instances except the one where the view
recompilation is being executed.
cd
$ORACLE_HOME/cpu/view_recompile
sqlplus
/nolog
SQL>
CONNECT / AS SYSDBA
SQL>
STARTUP NOMOUNT
SQL>
ALTER SYSTEM SET CLUSTER_DATABASE=FALSE SCOPE=spfile;
SQL>
SHUTDOWN
SQL>
STARTUP UPGRADE
SQL> @?/
cpu/view_recompile /view_recompile_jan2008cpu.sql
SQL>
SHUTDOWN;
SQL>
STARTUP NOMOUNT;
Set the
CLUSTER_DATABASE initialization parameter to TRUE:
SQL>
ALTER SYSTEM SET CLUSTER_DATABASE=TRUE SCOPE=spfile;
Restart the
database:
SQL> QUIT
cd
$CRS_HOME/bin
srvctl start
database -d racdb
If any
invalid objects were reported, run the utlrp.sql script as follows:
cd
$ORACLE_HOME/rdbms/admin
sqlplus
/nolog
SQL>
CONNECT / AS SYSDBA
SQL>
@utlrp.sql
Then,
manually recompile any invalid objects. For example:
SQL>
alter package schemaname.packagename compile;
4. Verify
Patches are applied.
$opatch
lsinventory -detail -oh $CRS_HOME #if you have CRS_HOME
$opatch
lsinventory -detail -oh $ORACLE_HOME #if you have both ORACLE_HOME
The CPU patch was successfully applied.
Hope the
above post helps in understanding Database patches completely.
Best
regards,
Dimitrita
Mohanty
No comments:
Post a Comment