Friday, February 1, 2013

Upgrade from 11.2.0.1 to 11.2.0.3 (Part I Software Installation)

Part I : environment preparation & 11.2.0.3 Software Installation (Standalone DB)

In this part I'll discuss OUT-PLACE installation steps of Oracle 11.2.0.3 (standalone DB) on a Linux server already have an Oracle 11.2.0.1 setup with databases up and running.

Database upgrade steps (Standalone DB) will be covered in Part II

In case you're interested in RAC database upgrade from 11.2.0.1 to 11.2.0.3 I've explained a full implementation (cookbook) of upgrading a 11.2.0.1 to 11.2.0.3 RAC database on new servers (out-place upgrade) in this link:
http://dba-tips.blogspot.ae/2013/09/upgrade-rac-11201-to-11203-part-i.html

My current environment specs before the upgrade:
Oracle Enterprise Linux 5.8 X86_64
Oracle 11.2.0.1
3 Up and running 11.2.0.1 databases.
11.2.0.1 ORACLE_HOME = /u01/oracle/ora11gr2/11.2.0.1

My environment specs after the upgrade:
Oracle Enterprise Linux 5.8 X86_64
Oracle 11.2.0.3
3 Up and running 11.2.0.3 databases.
11.2.0.3 ORACLE_HOME = /u02/oracle/ora11g/11.2.0.3

Note: In this demonstration I'll do an Out-Place upgrade, this means I'll install the new software on a new ORACLE_HOME path which Oracle recommends.

In-Place upgrade means, to install the new software on the same location of the original old ORACLE_HOME, the thing requires to detach the old ORACLE_HOME first before installing the new software in-place of it, the thing will increases the downtime window.

Out-PLACE upgrade is much safer, easier, with minimal downtime if you compare it with the In-PLACE upgrade, the only disadvantage of Out-Place upgrade that it needs more space than the In-Place upgrade.


Environment Preparation:
#####################
Requirements for Linux :
===================
For RHEL 5 x86_64:

Minimum Red Hat/Oracle Enterprise Linux version is EL 5 Update 5
Minimum Unbreakable Enterprise Kernel => 2.6.32 or later

Currently I've Oracle Linux 5 Update 8 with Unbreakable kernel 2.6.32-300

Note: Starting with Oracle 11gR2, SELinux is supported.

If enabling Automatic Memory Management:
-----------------------------------------------------
/dev/shm must be greater than the sum of MEMORY_MAX_TARGET for all instance on the server.

Requirements for Linux x86_64 Packages: (install the same packages versions or later)
================================
All of these packages are already installed on my server as I already have 11.2.0.1 setup.

 Required packages for 11.2.0.2 and above (on OEL 5 x86_64):
--------------------------------------------------------------------------
rpm -qa | grep binutils-2.17.50.0.6
rpm -qa | grep compat-libstdc++-33-3.2.3
rpm -qa | grep elfutils-libelf-0.1
rpm -qa | grep elfutils-libelf-devel-0.1
rpm -qa | grep gcc-4.1.2
rpm -qa | grep gcc-c++-4.1.2
rpm -qa | grep glibc-2.5
rpm -qa | grep glibc-common-2.5
rpm -qa | grep glibc-devel-2.5
rpm -qa | grep glibc-headers-2.5
rpm -qa | grep ksh-2
rpm -qa | grep libaio-0.3.106
rpm -qa | grep libaio-devel-0.3.106
rpm -qa | grep libgcc-4.1.2
rpm -qa | grep libstdc++-4.1.2
rpm -qa | grep libstdc++-devel-4.1.2
rpm -qa | grep make-3.81
rpm -qa | grep sysstat-7.0.2
rpm -qa | grep unixODBC-2.2.11       #=> (32-bit) or later
rpm -qa | grep unixODBC-devel-2.2.11 #=> (64-bit) or later
rpm -qa | grep unixODBC-2.2.11       #=> (64-bit) or later


Create Oracle user:
===============
Note: Oracle user, DBA and OINSTALL groups are automatically created during Oracle Enterprise Linux installation, you can skip this step. also as we already have 11.2.0.1 Oracle installation on this server this gurantee that Oracle user with it's group is already there.

# groupadd -g 502 dba
groupadd -g 503 oinstall
useradd -u 505 -g oinstall -G dba -s /bin/bash -d /home/oracle  oracle
passwd oracle
mkdir -p /home/oracle
chown oracle:dba /home/oracle
chmod 750 /home/oracle

Create a new ORACLE_HOME path:
============================
mkdir -p /u02/oracle/ora11g/11.2.0.3
chown -R oracle:dba /u01/oracle/ora11g
chmod 750 /u02/oracle/ora11g/11.2.0.3

Create a new .bash_profile holds 11.2.0.3 Environment variables:
==================================================
As I already have an 11.2.0.1 installation on the server and I don't want to create a new oracle user to be the owner of the new 11.2.0.3 installation, I have to create a new .bash_profile file, holds the environment variables of the new ORACLE_HOME to not mix with the already running 11.2.0.1 setup.

This new .bash_profile which will name it .bash_profile11203 will holds the same Env variables from the original .bash_profile except replacing  $ORACLE_BASE & ORACLE_HOME variables with the ones pointing to 11.2.0.3 installation.
Each time I deal with 11.2.0.3 installation or databases running from 11.2.0.3 Oracle Home, I've to call that .bash_profile11203 .

# cd /home/oracle
# cp .bash_profile .bash_profile11203

Modify the new environment profile:
# vi .bash_profile11203
=>Run these two vi commands:

ESC  :
%s/\/u01\/oracle\/ora11gr2\/11\.2\.0\.1/\/u02\/oracle\/ora11g\/11\.2\.0\.3/g


%s/\/u01\/oracle/\/u02\/oracle/g

=> You've to customize the above command to replace old ORACLE_HOME path with the new ORACLE_HOME path.

Now I've a good new profile contains variables pointing to the new ORACLE_HOME installation.


Configure SYSTEM parameters:
=========================

All parameters should be same or greater on the OS:
--------------------------------------------------
# /sbin/sysctl -a | grep sem                      #=> semaphore parameters (250 32000 100 142).
# /sbin/sysctl -a | grep shm                 #=> shmmax, shmall, shmmni (536870912, 2097152, 4096).
# /sbin/sysctl -a | grep file-max                #=> (6815744).
# /sbin/sysctl -a | grep ip_local_port_range  #=> Minimum: 9000, Maximum: 65500
# /sbin/sysctl -a | grep rmem_default        #=> (262144).
# /sbin/sysctl -a | grep rmem_max            #=> (4194304).
# /sbin/sysctl -a | grep wmem_default       #=> (262144).
# /sbin/sysctl -a | grep wmem_max           #=> (1048576).
# /sbin/sysctl -a | grep aio-max-nr      #=> (Maximum: 1048576) limits concurrent requests to avoid
                                                           I/O Failures.

If you need to change any of these parameters, login as root user, modify file /etc/sysctl.conf then execute this command:
# sysctl -p

vi /etc/security/limits.conf --Already exist with bigger values so keep it as it except the last parameter.
---------------------------------
oracle   soft   nofile    131072
oracle   hard   nofile    131072
oracle   soft   nproc    131072
oracle   hard   nproc    131072
oracle   soft   core    unlimited
oracle   hard   core    unlimited
oracle   soft   memlock    50000000
oracle   hard   memlock    50000000
# Adjust MAX stack size for 11.2.0.3 => Original was 8192:
oracle   soft   stack    10240

After updating limits.conf user should logoff & logon to let new adjustments take effect.

Ensure mounting /usr in READ-WRITE mode:
====================================
# mount -o remount,rw /usr

>For security reasons some System Administrators prefer to mount /usr in READ ONLY mode, during Oracle installation /usr must be in RW mode.

Backup important files:
=================
# cp /etc/oraInst.loc /etc/oraInst.loc.11.2.0.1
# cp /etc/oratab.11.2.0.1

# cp /usr/local/bin/oraenv  /usr/local/bin/oraenv.11.2.0.1
# cp /usr/local/bin/dbhome  /usr/local/bin/dbhome.11.2.0.1
# cp /usr/local/bin/coraenv /usr/local/bin/coraenv.11.2.0.1

Create&Modify Oracle Inventory location: (By ROOT user)
===============================
# mkdir -p /u02/oracle/oraInventory
# vi /etc/oraInst.loc

inventory_loc=/u02/oracle/oraInventory
inst_group=oinstall

Run the new 11.2.0.3 PROFILE:
=========================
Set the new Env variables that point to the new ORACLE_HOME by running file .bash_profile1123:
cd /home/oracle
. .bash_profile1123


ORACLE 11.2.0.3 INSTALLATION:
#############################

Download the 11.2.0.3 installation files from Oracle support web site -it's not available on oracle.com site-
Go to Patches&Updates tab,
search for patch# 10404530 then select the right one for your platform (mine is Linux x86_64).
Download the first two files only (p10404530_112030_Linux-x86-64_1of7 , p10404530_112030_Linux-x86-64_2of7) for Oracle software installation only, if you'll install Grid for RAC or ASM (which is not in our scope) you need to download the first three files.
The rest of files are for (Client, Gateways, examples, deinstall) which are not in our scope.

You can select which mode you will use to perform the installation whether  GUI or SILENT mode, I'll discuss both of them in the coming lines.

Note: As we are doing an out-place upgrade, we will not touch the old Oracle Home, that means you don't need to shutdown the already running databases or listeners which runs from 11.2.0.1 Oracle Home. this explains how Out-Place upgrade minimize the downtime window.

Installation using GUI mode:
#####################
Login to your server using VNC or directly to the Console (physical access) with Oracle user.
Sometimes Sys admins lock direct login to Oracle user, if so login with root user then issue this command:
# xhost + 
Then switch to Oracle user
# su - oracle

To know how to use configure VNC on your server check this link:
http://dba-tips.blogspot.ae/2012/05/easy-way-to-configure-vnc-server-on.html

Go to the DVD location:
----------------------------
# cd /export/11.2.0.3/database

# ./runInstaller

Page1 (Configure Security Updates):
      Remove the check from"I wish to receive security updates via My Oracle Support"click Next..click YES
Page2 (Download Software Updates):
      Check "Skip software updates" ...click Next (My server doesn't have access to the internet).
Page3 (Installation Option):
      Check "Install database software only" ...click Next
Page4 (Grid Installation Options):
      Check "Single instance database installation" ...click Next
Page5 (Product Languages):
      Leave it to the default ...click Next
Page6 (Database Edition):
      Enterprise Edition ...click select options..(check the needed options)..click OK..click Next
Page7 (Installation Location):
      ORACLE_BASE: /u02/oracle , Software Location: /u02/oracle/ora11g/11.2.0.3 (software location is ORACLE_HOME).
Page8 (Operating System Groups):
      Database Administrator (OSDBA) Group ...select "dba"
      Database Operator (OSOPER) Group (Optional) ..leave it blank  >>I never had a need to connect to the database as SYSOPER.
Page9 (Summary):
      Click Install
      At the end of installation: 
      from another session by root user execute script $ORACLE_HOME/root.sh 
Page10 (Finish):
      Once executed root.sh script from another session, go back to the OUI window and click Exit.

Note: if you want to create a response file, from runInstaller GUI do this:
# cd /u02/11.2.0.3/database
# ./runInstaller
Choose Options you need to install ,at the "Summary" screen click "Save responsefile" button.


Installation using SILENT mode:
========================

# cd /export/11.2.0.3/database

# ./runInstaller -silent -ignoreSysPrereqs -ignorePrereq -ignoreInternalDriverError -showProgress -noconfig
-responseFile /u02/11.2.0.3/database/response/db_install.rsp 
ORACLE_BASE=/u02/oracle
ORACLE_HOME=/u02/oracle/ora11g/11.2.0.3
INVENTORY_LOCATION=/u02/oracle/oraInventory
ORACLE_HOME_NAME=OraDbHome11203
oracle.install.option=INSTALL_DB_SWONLY
oracle.install.db.InstallEdition=EE
UNIX_GROUP_NAME=oinstall
oracle.install.db.DBA_GROUP=dba
DECLINE_SECURITY_UPDATES=true
oracle.install.db.optionalComponents=oracle.rdbms.lbac:11.2.0.3.0,oracle.rdbms.dm:11.2.0.3.0,oracle.rdbms.dv:11.2.0.3.0,oracle.rdbms.rat:11.2.0.3.0


Note:
----
oracle.install.db.optionalComponents=
oracle.oraolap:11.2.0.3.0               - Oracle OLAP
oracle.rdbms.dm:11.2.0.3.0           - Oracle Data Mining RDBMS Files
oracle.rdbms.dv:11.2.0.3.0            - Oracle Database Vault option
oracle.rdbms.lbac:11.2.0.3.0         - Oracle Label Security
oracle.rdbms.partitioning:11.2.0.3.0 - Oracle Partitioning
oracle.rdbms.rat:11.2.0.3.0           - Oracle Real Application Testing
That means the options I'm installing are: Oracle Label Security, Data Mining, Database Vault, Real Application Testing. 
-showProgress :Showing the progress of the installation on the screen.
-noconfig: Supress running configuration assistants during installation as it will be "Software Only"

>>Progress will be printed on the screen also you can check the log:
# tail -f /u02/oracle/oraInventory/logs/installActions<$date_$time>.log


Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 2872 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 12768 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-01-02_12-13-51PM. Please wait ...
[oracle@dev1 database]#
[oracle@dev1 database]#You can find the log of this install session at:
 /u02/oracle/oraInventory/logs/installActions2013-01-02_12-13-51PM.log

Prepare in progress.
..................................................   9% Done.

Prepare successful.

Copy files in progress.
..................................................   14% Done.
..................................................   20% Done.
..................................................   26% Done.
..................................................   31% Done.
..................................................   36% Done.
..................................................   44% Done.
..................................................   49% Done.
..................................................   55% Done.
..................................................   63% Done.
..................................................   68% Done.
..................................................   73% Done.
..................................................   78% Done.
..................................................   83% Done.
..............................
Copy files successful.

Link binaries in progress.
..........
Link binaries successful.

Setup files in progress.
..................................................   88% Done.
..................................................   94% Done.

Setup files successful.
The installation of Oracle Database 11g was successful.
Please check '/u02/oracle/oraInventory/logs/silentInstall2013-01-02_12-13-51PM.log' for more details.

Execute Root Scripts in progress.

As a root user, execute the following script(s):
1. /u02/oracle/ora11g/11.2.0.3/root.sh


..................................................   100% Done.

Execute Root Scripts successful.
Successfully Setup Software.


At the End of the installation: (By root user run root.sh script):
# /u02/oracle/ora11g/11.2.0.3/root.sh

Installation is done.


Backup oraInventory directory:
-------------------------------------
# tar cvf /u02/oracle/oraInventory.tar   /u02/oracle/oraInventory

Backup root.sh:
------------------
# cp /u02/oracle/ora11g/11.2.0.3/root.sh /u02/oracle/ora11g/11.2.0.3/root.sh_after_installation

Backup ORACLE_HOME: (By root user)
-------------------------------
# tar cvpf /u02/oracle/ora11g/11.2.0.3_After_DB_install.tar   /u02/oracle/ora11g/11.2.0.3

Backup the following files:
-------------------------------
# cp /usr/local/bin/oraenv  /usr/local/bin/oraenv.11.2.0.3
# cp /usr/local/bin/dbhome  /usr/local/bin/dbhome.11.2.0.3
# cp /usr/local/bin/coraenv /usr/local/bin/coraenv.11.2.0.3


PSU Patch Apply: 
##############
Apply the latest PSU patch on the 11.2.0.3 ORACLE_HOME before upgrading the database, PSU patch post steps which runs on the database like catbunddel.sql are not required (unless the PATCH README mention post steps to be applied after DB Creation|Upgrade), because every PSU patch is unique. As per .

Download and Install latest OPatch utility: Patch# 6880880 (For 11.2.0.3 on Linux X64_68)
Latest OPatch utility was 11.2.0.3.3

# cd $ORACLE_HOME
# tar cvf OPatch.org.tar OPatch
# cd OPatch
# rm -rf *
# cd $ORACLE_HOME
# unzip p6880880_112000_Linux-x86-64.zip

Download & Apply latest PSU patch 11.2.0.3.4 :  Metalink patch# 14275605
  # unzip p14275605_112030_Linux-x86-64.zip
  # cd 14275605
  # opatch apply

Now you're done with PSU patch apply.


In the next post Part II, I'll demonstrate database upgrade (Standalone) from 11.2.0.1 to 11.2.0.3 using manual & DBUA ways.