Search This Blog

Friday, April 25, 2014

Upgrade Oracle Database from 11.2.0.1.0 to 11.2.0.3.0

Upgrade Oracle Database from 11.2.0.1.0 to 11.2.0.3.0 : 


DBUA GUI Method:

The DBUA automates the upgrade process by performing all of the tasks normally performed manually. The DBUA makes appropriate recommendations for configuration options such as tablespaces and redo logs. This method is very easy and user friendly done via GUI. But if any error occurs it will take lot of time to diagnose the error as the upgrade process is done automatically by the upgrade assistant.

Manual Method:

  We used the manual method for upgrade by performing the following steps in order below

·      Download the patch 10404530 form support.oracle.com
·      Unzip the patch 10404530 to an appropriate location where the user Oracle has access to read and write on the location usually $HOME.
·      Shutdown database, listener or any other service or application that’s connects to the database.



[oracle@racdt admin]$  sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 18 11:56:06 2014

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

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit    Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options
[oracle@racdt admin]$ lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-FEB-2014 12:04:08

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully
[oracle@racdt admin]$  


·      Backup the database. We took cold backup using OS copy command as the database is down and also it’s appropriate to take cold back as the database is down rather than going for dump.


-----Backup all the dbf files, control files and redo-log files from directory “/u01/app/oracle/oradata” to directory “/mnt/backups/devtest”
# cd /mnt/backups/devtest
# cp -R /u01/app/oracle/oradata/racdt racdt.bkp


·      Change directory into the unzipped file
·      Install latest or new release Oracle Software on to the area designated for New Oracle Home.
·      Make sure your System meet the new Oracle software requirements by running only check pre-requisite first.
·      After the successful installation of new Oracle Software set the environment variables in UNIX/Linux, set the $ORACLE_HOME and $PATH variables to point to the new 11g Oracle home. And make the existing home as $OLD_HOME.
·      Copy the required files from $OLD_HOME to $ORACLE_HOME such as “spfile, pfile, password file, tnsnames.ora, listener.ora, sqlnet.ora”


[oracle@racdt ~]$  cd $OLD_HOME/dbs
[oracle@racdt dbs]$  
[oracle@racdt dbs]$  cp init.ora  $ORACLE_HOME/dbs/
[oracle@racdt dbs]$  
[oracle@racdt dbs]$  cp spfile.ora  $ORACLE_HOME/dbs/
[oracle@racdt dbs]$  
[oracle@racdt dbs]$  cp orapwd.ora  $ORACLE_HOME/dbs/
[oracle@racdt dbs]$  
[oracle@racdt dbs]$  cd $OLD_HOME/network/admin
[oracle@racdt dbs]$  
[oracle@racdt admin]$  cp *.ora  $ORACLE_HOME/network/admin/
[oracle@racdt admin]$  


·      Set the New Oracle Home variable in files wherever applicable such as “profile, oratab, startup scripts, tnsnames.ora, listener.ora, sqlnet.ora”.
·      Analyze the existing instance using the "$ORACLE_HOME/rdbms/admin/utlu111i.sql" script, explained below.
·      Start the original database using the STARTUP UPGRADE command and proceed with the upgrade by running the "$ORACLE_HOME/rdbms/admin/catupgrd.sql" script.
·      Invalidate all the objects by running "$ORACLE_HOME/rdbms/admin/utlirp.sql"
·      Recompile invalid objects by running "$ORACLE_HOME/rdbms/admin/utlrp.sql"
·      Restart the database in normal read-write mode.
·      Run the "$ORACLE_HOME/rdbms/admin/utlu111s.sql" script and check the result of the upgrade.
·      Troubleshoot any issues or abort the upgrade. We encountered swap space error during the upgrade and had to run through the following steps.






Swap space is a reserved space on disk which oracle uses in case it needs extra memory for processing the data.
For Oracle 11g database, the following is the recommendation from Oracle for swap space:
  • If RAM size is less than or equal to 2 GB, swap size should be 1.5 times of the RAM.
  • If RAM size is between 2 GB and 16 GB, swap size should be the same size of the RAM.
  • If RAM size is more than 16 GB, your swap size should be 16 GB. 
There are two ways we can create swap space
1) By creating disk partition
2) By adding a swap file

Use following instructions to create a swap file

a) Create storage file

#  dd   if=/dev/zero   of=/swapfile1   bs=1024   count=524288


b) Create swap file

#  mkswap   /swapfile1


c) Change the file permission to make sure “oracle” can read and write to it

# chown oracle:oinstall /swapfile1
# chmod 755 /swapfile1


d) Activate swap file

#  swapon  /swapfile1
                                                    

e) To activate swapfile after Linux system reboot, add entry to /etc/fstab file.
# vi /etc/fstab

##Append the following line:
/swapfile1   swap   swap   defaults   0   0


f) Verify if the swap space is enabled or not.

$ free  -m
                        total       used       free     shared    buffers     cached
Mem:               7982      1870       6112          0        197       1279
-/+ buffers/cache:             392       7590
Swap:              9183            0       9183


g) To query for the swap usage

# swapon –s

Filename                                                     Type              Size           Used    Priority
/dev/mapper/VolGroup00-LogVol01             partition       9404408         0             -1
/swapfile1                                                    file                524280         0             -1



No comments:

Post a Comment