Tuesday, April 5, 2011

Patching an Oracle Database 9i

This is a transcript of a session where it was applied a patch to an Oracle Database 9i installation in an AIX system; in general applying a patch with OPatch is very similar in all Oracle 9i and above platforms but it is a good idea to read the documentation of a particular patch.

First we check the availability of perl and java and its version because it is a prerequisite for OPatch; the version needed depends of the OPatch version to use.

myserver:mydb> perl -v

This is perl, v5.8.2 built for aix-thread-multi
(with 3 registered patches, see perl -V for more detail)

Copyright 1987-2003, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

myserver:mydb> java -fullversion
java full version "J2RE 1.4.2 IBM AIX build ca142-20080515 (SR11)"
myserver:mydb> oslevel
5.3.0.0

Next we add OPatch directory to the execution path in case it is not, and list the patch inventory to know about existing patches:

myserver:mydb> ls -la $ORACLE_HOME/OPatch
total 64
drwxr-x--- 5 oracle dba 256 Mar 03 2008 .
drwxr-xr-x 57 oracle dba 4096 May 10 11:18 ..
drwxr-x--- 2 oracle dba 256 Mar 03 2008 docs
drwxr-x--- 2 oracle dba 256 Mar 03 2008 jlib
-rwxr-xr-x 1 oracle dba 6143 Jun 09 2005 opatch
-rw-r--r-- 1 oracle dba 0 Mar 03 2008 opatch.ini
-rw-r--r-- 1 oracle dba 13703 Jun 09 2005 opatch.pl
drwxr-x--- 2 oracle dba 4096 Mar 03 2008 perl_modules
myserver:mydb> export PATH=$PATH:$ORACLE_HOME/OPatch
myserver:mydb> opatch lsinventory

Oracle Interim Patch Installer version 1.0.0.0.52
Copyright (c) 2005 Oracle Corporation. All Rights Reserved..

We recommend you refer to the OPatch documentation under
OPatch/docs for usage reference. We also recommend using
the latest OPatch version. For the latest OPatch version
and other support related issues, please refer to document
293369.1 which is viewable from metalink.oracle.com

Oracle Home = /oracle_9i/app/oracle/product/9.2.0
Location of Oracle Universal Installer components = /oracle_9i/app/oracle/product/9.2.0/oui
Location of OraInstaller.jar = "/oracle_9i/app/oracle/product/9.2.0/oui/jlib"
Oracle Universal Installer shared library = /oracle_9i/app/oracle/product/9.2.0/oui/lib/aix/liboraInstaller.so
Location of Oracle Inventory Pointer = /etc/oraInst.loc
Location of Oracle Inventory = /oracle_9i/app/oracle/product/9.2.0/inventory
Path to Java = /oracle_9i/app/oracle/product/9.2.0/jre/1.4.2/bin/java
Log file = /oracle_9i/app/oracle/product/9.2.0/.patch_storage//*.log

Creating log file "/oracle_9i/app/oracle/product/9.2.0/.patch_storage/LsInventory__06-29-2010_16-27-35.log"

Result:


There is no Interim Patch




OPatch succeeded.

It is mandatory almost all the time (or at least a good idea) to stop all instances and database services dependent of the Oracle Home being patched; if you don't want to stop your databases check if the patch you want to apply could be applied without shutting down services.

myserver:mydb> lsnrctl stop LISTENER_mydb

LSNRCTL for IBM/AIX RISC System/6000: Version 9.2.0.7.0 - Production on 29-JUN-2010 18:03:04

Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myserver)(IP=10.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=mydb)))
The command completed successfully
myserver:mydb> sqlplus '/ as sysdba'

SQL*Plus: Release 9.2.0.7.0 - Production on Tue Jun 29 18:03:28 2010

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.7.0 - Production

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.7.0 - Production

Now we apply the patch going to the patch directory and running opatch; OPatch has a lot of options but applying a single patch for just an Oracle Home is the easier of the scenarios:

myserver:mydb> cd /oracle_resp9/p5496862_92070_AIX64-5L/5496862
myserver:mydb> ls -la
total 16
drwx------ 4 oracle dba 256 Jun 09 11:03 .
drwx------ 3 oracle dba 256 Jun 09 11:03 ..
-rw------- 1 oracle dba 4710 Jun 09 10:52 README.txt
drwx------ 4 oracle dba 256 Jun 09 11:03 etc
drwx------ 4 oracle dba 256 Jun 09 11:03 files
myserver:mxod0012> opatch apply

Oracle Interim Patch Installer version 1.0.0.0.52
Copyright (c) 2005 Oracle Corporation. All Rights Reserved..

We recommend you refer to the OPatch documentation under
OPatch/docs for usage reference. We also recommend using
the latest OPatch version. For the latest OPatch version
and other support related issues, please refer to document
293369.1 which is viewable from metalink.oracle.com

Oracle Home = /oracle_9i/app/oracle/product/9.2.0
Location of Oracle Universal Installer components = /oracle_9i/app/oracle/product/9.2.0/oui
Location of OraInstaller.jar = "/oracle_9i/app/oracle/product/9.2.0/oui/jlib"
Oracle Universal Installer shared library = /oracle_9i/app/oracle/product/9.2.0/oui/lib/aix/liboraInstaller.so
Location of Oracle Inventory Pointer = /etc/oraInst.loc
Location of Oracle Inventory = /oracle_9i/app/oracle/product/9.2.0/inventory
Path to Java = /oracle_9i/app/oracle/product/9.2.0/jre/1.4.2/bin/java
Log file = /oracle_9i/app/oracle/product/9.2.0/.patch_storage//*.log

Creating log file "/oracle_9i/app/oracle/product/9.2.0/.patch_storage/5496862/Apply_5496862_06-29-2010_18-11-21.log"

Invoking fuser to check for active processes.

Backing up comps.xml ...

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


Please shut down Oracle instances running out of this ORACLE_HOME
(Oracle Home = /oracle_9i/app/oracle/product/9.2.0)
Is this system ready for updating?
Please respond Y|N >
Y
Patching...
Printing stderr to output (from /oracle_9i/app/oracle/product/9.2.0/.patch_storage/5496862/make_local.stderr)
ar: Creating an archive file /oracle_9i/app/oracle/product/9.2.0/lib/libclntst9.a.

ar: Creating an archive file /oracle_9i/app/oracle/product/9.2.0/lib32/libclntst9.a.


...


Updating inventory...
Backing up comps.xml ...


OPatch succeeded.

After applying the patch we start up the instances and database services and check the new Oracle version (if applies); some patches require you to execute scripts to change the databases and others don't so don't forget to read patch's documentation.

myserver:mydb> sqlplus '/ as sysdba'

SQL*Plus: Release 9.2.0.7.0 - Production on Tue Jun 29 18:20:06 2010

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 253723320 bytes
Fixed Size 742072 bytes
Variable Size 184549376 bytes
Database Buffers 67108864 bytes
Redo Buffers 1323008 bytes
Database mounted.
Database opened.
SQL> select * from v$instance;

INSTANCE_NUMBER INSTANCE_NAME
--------------- ----------------
HOST_NAME
----------------------------------------------------------------
VERSION STARTUP_T STATUS PAR THREAD# ARCHIVE LOG_SWITCH_
----------------- --------- ------------ --- ---------- ------- -----------
LOGINS SHU DATABASE_STATUS INSTANCE_ROLE ACTIVE_ST
---------- --- ----------------- ------------------ ---------
1 mydb
myserver
9.2.0.7.0 29-JUN-10 OPEN NO 1 STOPPED
ALLOWED NO ACTIVE PRIMARY_INSTANCE NORMAL


SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.7.0 - Production

myserver:mydb> lsnrctl start LISTENER_mydb

LSNRCTL for IBM/AIX RISC System/6000: Version 9.2.0.7.0 - Production on 29-JUN-2010 18:22:35

Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.

Starting /oracle_9i/app/oracle/product/9.2.0/bin/tnslsnr: please wait...

TNSLSNR for IBM/AIX RISC System/6000: Version 9.2.0.7.0 - Production
System parameter file is /oracle_9i/app/oracle/product/9.2.0/network/admin/listener.ora
Log messages written to /oracle_9i/app/oracle/product/9.2.0/network/log/listener_mydb.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=hsodbc)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=mydb)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myserver)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=IPC)(KEY=hsodbc))
STATUS of the LISTENER
------------------------
Alias LISTENER_mydb
Version TNSLSNR for IBM/AIX RISC System/6000: Version 9.2.0.7.0 - Production
Start Date 29-JUN-2010 18:22:35
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security OFF
SNMP OFF
Listener Parameter File /oracle_9i/app/oracle/product/9.2.0/network/admin/listener.ora
Listener Log File /oracle_9i/app/oracle/product/9.2.0/network/log/listener_mydb.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=hsodbc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=mydb)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myserver)(PORT=1521)))
Services Summary...
Service "mydb" has 1 instance(s).
Instance "mydb", status UNKNOWN, has 1 handler(s) for this service...
Service "hsodbc" has 1 instance(s).
Instance "hsodbc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

myserver:mydb> tnsping mydb

TNS Ping Utility for IBM/AIX RISC System/6000: Version 9.2.0.7.0 - Production on 29-JUN-2010 18:27:02

Copyright (c) 1997 Oracle Corporation. All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL=TCP) (HOST=myserver) (IP=10.0.0.1) (PORT=1521))) (CONNECT_DATA = (SID=mydb)))
OK (90 msec)

Finally, we list again the patch inventory and we should see the patch just applied:

myserver:mydb> opatch lsinventory

Oracle Interim Patch Installer version 1.0.0.0.52
Copyright (c) 2005 Oracle Corporation. All Rights Reserved..

We recommend you refer to the OPatch documentation under
OPatch/docs for usage reference. We also recommend using
the latest OPatch version. For the latest OPatch version
and other support related issues, please refer to document
293369.1 which is viewable from metalink.oracle.com

Oracle Home = /oracle_9i/app/oracle/product/9.2.0
Location of Oracle Universal Installer components = /oracle_9i/app/oracle/product/9.2.0/oui
Location of OraInstaller.jar = "/oracle_9i/app/oracle/product/9.2.0/oui/jlib"
Oracle Universal Installer shared library = /oracle_9i/app/oracle/product/9.2.0/oui/lib/aix/liboraInstaller.so
Location of Oracle Inventory Pointer = /etc/oraInst.loc
Location of Oracle Inventory = /oracle_9i/app/oracle/product/9.2.0/inventory
Path to Java = /oracle_9i/app/oracle/product/9.2.0/jre/1.4.2/bin/java
Log file = /oracle_9i/app/oracle/product/9.2.0/.patch_storage//*.log

Creating log file "/oracle_9i/app/oracle/product/9.2.0/.patch_storage/LsInventory__06-29-2010_18-26-05.log"

Result:


Installed Patch List:
=====================
1) Patch 5496862 applied on Tue Jun 29 17:15:41 GMT-06:00 2010
[ Base Bug(s): 5496862 ]




OPatch succeeded.

No comments:

Post a Comment