Sunday, 29 July 2012

Patch Set upgrade from 10.2.0.1 to 10.2.0.4

Upgrade Oracle from 10.2.0.1 to 10.2.0.4 using Patch set (Single Instance)

You can apply the Oracle Database release 10.2.0.4 patch set to the following Oracle Database 10g release 2 installations:

Oracle Database
Oracle Real Application Clusters
Oracle Database Client
Oracle Database Companion CD
Oracle Clusterware
Oracle Database Vault


Steps:

1. Download the Patch Set p6810189_10204_Linux-x86.zip from oracle support.

2. Inorder to upgrade to 10.2.0.4 our timezone file version should be 4, if it is less than/greater than 4 then
take action as per metalink note 553812.1

SQL> select * from V$timezone_file;

FILENAME VERSION
------------ ----------
timezlrg.dat 4

3. Set the Environment Varibales:-

Bourne, Bash, or Korn shell:

$ ORACLE_HOME=Oracle_home
$ ORACLE_SID=sid
$ export ORACLE_HOME ORACLE_SID

C shell:

% setenv ORACLE_HOME Oracle_home
% setenv ORACLE_SID sid



3. Stop all the process:

a. listener - $ lsnrctl stop
b. Enterprise Manager - $ emctl stop dbconsole
c. isqlplus - $ isqlplusctl stop


4. Take the backup of the following components.

1. Oracle Inventory, 
$ cp -r oraInventory /u01/bkpof10gbeforepatch/

2. Oracle 10g home 
$ cd /u02/app/oracle/product/10.2.0
$ tar -cvf /u01/bkpof10gbeforepatch/10.2.0.1_home_binaries.tar db_1

Here first change the directory to the previous one to the oracle home and then
take the tape archive (tar) bakup of the db_1 directory which contains all
the binaries of the current 10.2.0.1 version and it will store the
backup in the /u01/bkpof10gbeforepatch folder with name as 10.2.0.1_home_binaries.tar


3. Oracle 10g Database 
sql> create pfile = '/u01/bkpof10gbeforepatch/initfirstdb.ora' from spfile;
sql> shut immediate;
Take the backup of datafile, redologs and controlfiles.
$ cp -r firstdb /u01/bkpof10gbeforepatch/
Take the backup of Password file.
$ cd $ORACLE_HOME
$ cp orapwfirstdb /u01/bkpof10gbeforepatch 


5. Unzip the Downloaded Patch file.

$ unzip p6810189_10204_Linux-x86.zip -d /u01/patch
$ cd /u01/patch/disk1


7. If your doing a silent installation then modify the parameter in the response file
and start the runInstaller in silent mode.

$ cd /u01/patch/Disk1/response
$ vi patchset.rsp
Modify the values in the patchset.rsp file accordinly.
$ cd /u01/patch/Disk1
$ ./runInstaller -silent -responseFile /u01/patch/Disk1/response/patchset.rsp


6. If Installing through GUI mode and not installing the Patch on the local machine
then enable the X forward on your desktop

In your desktop you need to have a software to forward the X Server Screens. eg. cygwin.
Here we have installed cygwin tool.

Double click the cygwin tool from you desktop and enter startxwin.


$ startxwin


It will open a xterminal , there enter the host name where your perfoming the 
patch installation.

$ xhost + 192.168.1.4
192.168.1.4 being added to access control list


In your server set the display variable to where you want to forward your 
GUI Screen, here to the desktop. 

Bourne, Bash, or Korn shell:

$ export DISPLAY=192.168.1.2:0.0

C shell:

% setenv DISPLAY l192.168.1.2:0.0



8. Start the runInstaller.

$ cd /u01/patch/Disk1
$ ./runInstaller


9. Once the installation is complete it will as for to run the root.sh script
run this script as root user.

# sh /u02/app/oracle/product/10.2.0/db_1/root.sh

Running Oracle10 root.sh script...

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u02/app/oracle/product/10.2.0/db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.


10. Now upgrade the database from 10.2.0.1 to 10.2.0.4


[oracle@rhel11g Disk1]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Thu Oct 20 10:20:04 2011

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to an idle instance.

SQL> startup upgrade
ORACLE instance started.

Total System Global Area 444596224 bytes
Fixed Size 1267980 bytes
Variable Size 159385332 bytes
Database Buffers 281018368 bytes
Redo Buffers 2924544 bytes
Database mounted.
Database opened.



--Run the preupgrade tool and action accordingly.

SQL> @?/rdbms/admin/utlu102i.sql
Oracle Database 10.2 Upgrade Information Utility 10-20-2011 10:24:36
.
**********************************************************************
Database:
**********************************************************************
--> name: FIRSTDB
--> version: 10.2.0.1.0
--> compatible: 10.2.0.1.0
--> blocksize: 8192
.
**********************************************************************
Tablespaces: [make adjustments in the current environment]
**********************************************************************
--> SYSTEM tablespace is adequate for the upgrade.
.... minimum required size: 486 MB
.... AUTOEXTEND additional space required: 6 MB
--> UNDOTBS1 tablespace is adequate for the upgrade.
.... minimum required size: 403 MB
.... AUTOEXTEND additional space required: 378 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 247 MB
.... AUTOEXTEND additional space required: 7 MB
--> TEMP tablespace is adequate for the upgrade.
.... minimum required size: 58 MB
.... AUTOEXTEND additional space required: 38 MB
.
**********************************************************************
Update Parameters: [Update Oracle Database 10.2 init.ora or spfile]
**********************************************************************
-- No update parameter changes are required.
.
**********************************************************************
Renamed Parameters: [Update Oracle Database 10.2 init.ora or spfile]
**********************************************************************
-- No renamed parameters found. No changes are required.
.
**********************************************************************
Obsolete/Deprecated Parameters: [Update Oracle Database 10.2 init.ora or spfile]
**********************************************************************
-- No obsolete parameters found. No changes are required
.
**********************************************************************
Components: [The following database components will be upgraded or installed]
**********************************************************************
--> Oracle Catalog Views [upgrade] VALID
--> Oracle Packages and Types [upgrade] VALID
--> JServer JAVA Virtual Machine [upgrade] VALID
--> Oracle XDK for Java [upgrade] VALID
--> Oracle Java Packages [upgrade] VALID
--> Oracle Text [upgrade] VALID
--> Oracle XML Database [upgrade] VALID
--> Oracle Workspace Manager [upgrade] VALID
--> Oracle Data Mining [upgrade] VALID
--> OLAP Analytic Workspace [upgrade] VALID
--> OLAP Catalog [upgrade] VALID
--> Oracle OLAP API [upgrade] VALID
--> Oracle interMedia [upgrade] VALID
--> Spatial [upgrade] VALID
--> Expression Filter [upgrade] VALID
--> EM Repository [upgrade] VALID
--> Rule Manager [upgrade] VALID
.

PL/SQL procedure successfully completed.


SQL> alter database datafile '/u02/app/oracle/firstdb/system01.dbf' resize 500m;
Database altered.

SQL> alter database datafile '/u02/app/oracle/firstdb/undotbs01.dbf' resize 450m;
Database altered.

SQL> alter database datafile '/u02/app/oracle/firstdb/sysaux01.dbf' resize 250m;

Database altered.

SQL> alter database tempfile '/u02/app/oracle/firstdb/temp01.dbf' resize 100m;

Database altered.

-- Run the catalog upgrade script

SQL>@?/rdbms/admin/catupgrd.sql


---
---
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UPGRD_END 2011-10-20 11:05:47
.
Oracle Database 10.2 Upgrade Status Utility 10-20-2011 11:05:47
.
Component Status Version HH:MM:SS
Oracle Database Server VALID 10.2.0.4.0 00:08:15
JServer JAVA Virtual Machine VALID 10.2.0.4.0 00:02:37
Oracle XDK VALID 10.2.0.4.0 00:00:27
Oracle Database Java Packages VALID 10.2.0.4.0 00:00:23
Oracle Text VALID 10.2.0.4.0 00:00:21
Oracle XML Database VALID 10.2.0.4.0 00:01:17
Oracle Workspace Manager VALID 10.2.0.4.3 00:00:29
Oracle Data Mining VALID 10.2.0.4.0 00:00:18
OLAP Analytic Workspace VALID 10.2.0.4.0 00:00:16
OLAP Catalog VALID 10.2.0.4.0 00:00:41
Oracle OLAP API VALID 10.2.0.4.0 00:00:38
Oracle interMedia VALID 10.2.0.4.0 00:03:22
Spatial VALID 10.2.0.4.0 00:01:26
Oracle Expression Filter VALID 10.2.0.4.0 00:00:08
Oracle Enterprise Manager VALID 10.2.0.4.0 00:01:10
Oracle Rule Manager VALID 10.2.0.4.0 00:00:06
.
Total Upgrade Time: 00:22:00
DOC>#######################################################################
DOC>#######################################################################
DOC>
DOC> The above PL/SQL lists the SERVER components in the upgraded
DOC> database, along with their current version and status.
DOC>
DOC> Please review the status and version columns and look for
DOC> any errors in the spool log file. If there are errors in the spool
DOC> file, or any components are not VALID or not the current version,
DOC> consult the Oracle Database Upgrade Guide for troubleshooting
DOC> recommendations.
DOC>
DOC> Next shutdown immediate, restart for normal operation, and then
DOC> run utlrp.sql to recompile any invalid application objects.
DOC>
DOC>#######################################################################
DOC>#######################################################################

SQL> shutdown immediate;

SQL> EXIT;


$ sqlplus / as sysdba

sql> startup

ORACLE instance started.

Total System Global Area 444596224 bytes
Fixed Size 1267980 bytes
Variable Size 192939764 bytes
Database Buffers 247463936 bytes
Redo Buffers 2924544 bytes
Database mounted.
Database opened.


--Now run the ultrp.sql script to recompile all the invalid objects.


SQL> @?/rdbms/admin/utlrp.sql;


PL/SQL procedure successfully completed.

SQL> col comp_id form a10;
SQL> col comp_name form a30;
SQL> col version form a10;
SQL> select COMP_ID,COMP_NAME,VERSION,STATUS,MODIFIED from dba_registry;

COMP_ID COMP_NAME VERSION STATUS MODIFIED
---------- ------------------------------ ---------- ----------- --------------------
CATALOG Oracle Database Catalog Views 10.2.0.4.0 VALID 20-OCT-2011 11:11:53
CATPROC Oracle Database Packages and T 10.2.0.4.0 VALID 20-OCT-2011 11:11:53
ypes

OWM Oracle Workspace Manager 10.2.0.4.3 VALID 20-OCT-2011 11:11:53
JAVAVM JServer JAVA Virtual Machine 10.2.0.4.0 VALID 20-OCT-2011 11:11:53
XML Oracle XDK 10.2.0.4.0 VALID 20-OCT-2011 11:11:53
CATJAVA Oracle Database Java Packages 10.2.0.4.0 VALID 20-OCT-2011 11:11:53
EXF Oracle Expression Filter 10.2.0.4.0 VALID 20-OCT-2011 11:11:53
ODM Oracle Data Mining 10.2.0.4.0 VALID 20-OCT-2011 11:11:53
CONTEXT Oracle Text 10.2.0.4.0 VALID 20-OCT-2011 11:11:53
XDB Oracle XML Database 10.2.0.4.0 VALID 20-OCT-2011 11:11:53
RUL Oracle Rule Manager 10.2.0.4.0 VALID 20-OCT-2011 11:11:53
ORDIM Oracle interMedia 10.2.0.4.0 VALID 20-OCT-2011 11:11:53
APS OLAP Analytic Workspace 10.2.0.4.0 VALID 20-OCT-2011 11:11:54
XOQ Oracle OLAP API 10.2.0.4.0 VALID 20-OCT-2011 11:11:54
AMD OLAP Catalog 10.2.0.4.0 VALID 20-OCT-2011 11:11:56
SDO Spatial 10.2.0.4.0 VALID 20-OCT-2011 11:11:56
EM Oracle Enterprise Manager 10.2.0.4.0 VALID 20-OCT-2011 11:05:40

SQL> select CNAME,VERSION,STATUS,MODIFIED,DATE_UPGRADED,ORG_VERSION,PRV_VERSION from registry$;

CNAME VERSION STATUS MODIFIED DATE_UPGR ORG_VERSION PRV_VERSION
---------------------------------------- ---------- ---------- --------- --------- ------------------------------ ------------------------------
Oracle Database Catalog Views 10.2.0.4.0 1 20-OCT-11 10.2.0.1.0 10.2.0.1.0
Oracle Database Packages and Types 10.2.0.4.0 1 20-OCT-11 10.2.0.1.0 10.2.0.1.0
Oracle Workspace Manager 10.2.0.4.3 1 20-OCT-11 20-OCT-11 10.2.0.1.0
JServer JAVA Virtual Machine 10.2.0.4.0 1 20-OCT-11 10.2.0.1.0 10.2.0.1.0
Oracle XDK 10.2.0.4.0 1 20-OCT-11 10.2.0.1.0 10.2.0.1.0
Oracle Database Java Packages 10.2.0.4.0 1 20-OCT-11 10.2.0.1.0 10.2.0.1.0
Oracle Expression Filter 10.2.0.4.0 1 20-OCT-11 10.2.0.1.0 10.2.0.1.0
Oracle Data Mining 10.2.0.4.0 1 20-OCT-11 20-OCT-11 10.2.0.1.0
Oracle Text 10.2.0.4.0 1 20-OCT-11 10.2.0.1.0 10.2.0.1.0
Oracle XML Database 10.2.0.4.0 1 20-OCT-11 10.2.0.1.0 10.2.0.1.0
Oracle Rule Manager 10.2.0.4.0 1 20-OCT-11 10.2.0.1.0 10.2.0.1.0
Oracle interMedia 10.2.0.4.0 1 20-OCT-11 10.2.0.1.0 10.2.0.1.0
OLAP Analytic Workspace 10.2.0.4.0 1 20-OCT-11 20-OCT-11 10.2.0.1.0 10.2.0.1.0
Oracle OLAP API 10.2.0.4.0 1 20-OCT-11 20-OCT-11 10.2.0.1.0 10.2.0.1.0
OLAP Catalog 10.2.0.4.0 1 20-OCT-11 20-OCT-11 10.2.0.1.0 10.2.0.1.0
Spatial 10.2.0.4.0 1 20-OCT-11 10.2.0.1.0 10.2.0.1.0
Oracle Enterprise Manager 10.2.0.4.0 1 20-OCT-11 20-OCT-11 10.2.0.1.0

Run the post upgrade script and check the status.

SQL> @?/rdbms/admin/utlu102s.sql;
.
Oracle Database 10.2 Upgrade Status Utility 10-20-2011 11:25:45
.
Component Status Version HH:MM:SS
Oracle Database Server VALID 10.2.0.4.0 00:08:15
JServer JAVA Virtual Machine VALID 10.2.0.4.0 00:02:37
Oracle XDK VALID 10.2.0.4.0 00:00:27
Oracle Database Java Packages VALID 10.2.0.4.0 00:00:23
Oracle Text VALID 10.2.0.4.0 00:00:21
Oracle XML Database VALID 10.2.0.4.0 00:01:17
Oracle Workspace Manager VALID 10.2.0.4.3 00:00:29
Oracle Data Mining VALID 10.2.0.4.0 00:00:18
OLAP Analytic Workspace VALID 10.2.0.4.0 00:00:16
OLAP Catalog VALID 10.2.0.4.0 00:00:41
Oracle OLAP API VALID 10.2.0.4.0 00:00:38
Oracle interMedia VALID 10.2.0.4.0 00:03:22
Spatial VALID 10.2.0.4.0 00:01:26
Oracle Expression Filter VALID 10.2.0.4.0 00:00:08
Oracle Enterprise Manager VALID 10.2.0.4.0 00:01:10
Oracle Rule Manager VALID 10.2.0.4.0 00:00:06
.
Total Upgrade Time: 00:22:00

PL/SQL procedure successfully completed.

-Upgrade Process Completed---


Running changePerm.sh Script on an Oracle Database Server Home

Important:
Oracle recommends using the most restrictive file permissions possible for the given implementation. 
Perform these optional steps only after considering all security ramifications and only if you need to share this installation.

During patch set installation, all new files and directories are created with restricted access, by default. Users or third party 
applications with a different group identifier from that of the database, which try to access client-side utilities or libraries in the database home, 
will see permission errors when trying to access these files or directories. Perform the following steps to change the permissions:

Change to the install directory by using the following command:

$ cd $ORACLE_HOME/install

Run changePerm.sh and specify the patched server Oracle home location, before accessing client-side utilities or libraries in the database home.


===Revert back the change using the backup if any problem occurs=========

Remove the Oracle inventory

$ cd /u01/app
$ rm -r oraInventory


Remove the oracle home

$ cd /u02/app/oracle/product/10.2.0
$ rm -r db_1


Remove the databasefile, controlfiles and redo files

$ cd /u02/app/oracle
$ rm -r firstdb


Restore the oracle inventory from backup

$ cd /u01/bkpof10gbeforepatch
$ cp -r oraInventory /u01/app

Restore the oracle home from backup 

$ cd /u02/app/oracle/product/10.2.0/
$ tar -xvf /u01/bkpof10gbeforepatch/10.2.0.1_home.tar

Restore the database from backup

$ cp -r /u01/bkpof10gbeforepatch/firstdb /u02/app/oracle/

Start the Database:-

[oracle@rhel11g ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Oct 20 21:51:12 2011

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 444596224 bytes
Fixed Size 1219904 bytes
Variable Size 159384256 bytes
Database Buffers 281018368 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.

sql> select COMP_NAME, VERSION, status from dba_registry;

COMP_NAME VERSION STATUS
-------------------------------------------------- ------------------------------ -----------
Oracle Database Catalog Views 10.2.0.1.0 VALID
Oracle Database Packages and Types 10.2.0.1.0 VALID
Oracle Workspace Manager 10.2.0.1.0 VALID
JServer JAVA Virtual Machine 10.2.0.1.0 VALID
Oracle XDK 10.2.0.1.0 VALID
Oracle Database Java Packages 10.2.0.1.0 VALID
Oracle Expression Filter 10.2.0.1.0 VALID
Oracle Data Mining 10.2.0.1.0 VALID
Oracle Text 10.2.0.1.0 VALID
Oracle XML Database 10.2.0.1.0 VALID
Oracle Rules Manager 10.2.0.1.0 VALID
Oracle interMedia 10.2.0.1.0 VALID
OLAP Analytic Workspace 10.2.0.1.0 VALID
Oracle OLAP API 10.2.0.1.0 VALID
OLAP Catalog 10.2.0.1.0 VALID
Spatial 10.2.0.1.0 VALID
Oracle Enterprise Manager 10.2.0.1.0 VALID

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

The change has been reverted successfully.

No comments:

Post a Comment