Install Oracle 11G Release 2 (11.2) on Centos 6

This article presents how to install Oracle on Centos 6.

Read following article how to install Centos 6 Linux: Install Centos 6 (allocate 64G for disk and set 2G memory for your virtual machine before proceeding with Oracle software installation).

Check latest article How to install Oracle 12C (12.1.0.1) on Centos 6 with UDEV disks, NFS disks, kmod-oracleasm library

Software

Installation software is available on OTN version 11.2.0.1 or metalink 11.2.0.3. In this installation I’m presenting installation for 11.2.0.3 but for previous version 11.2.0.X it shouldn’t be different.

Binaries 11.2.0.3

p10404530_112030_Linux-x86-64_1of7.zip - database software
p10404530_112030_Linux-x86-64_2of7.zip - database software
p10404530_112030_Linux-x86-64_3of7.zip - grid software

OS configuration and preparation – as root user

Add groups

--required groups
/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 503 oper
Add users
/usr/sbin/useradd -u 502 -g oinstall -G dba,oper oracle
Modification and verification for user and groups can be done in graphical mode -run from menu: System->Administration->Users and Groups

Change password for users

passwd oracle
Add kernel parameters to /etc/sysctl.conf
--kernel parameters for 11g installation
kernel.shmmni = 4096 
kernel.shmmax = 4398046511104
kernel.shmall = 1073741824
kernel.sem = 250 32000 100 128

fs.aio-max-nr = 1048576
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586

Apply kernel parameters

/sbin/sysctl -p

Add following line for user grid and oracle shell limits in file /etc/security/limits.conf

--shell limits for users oracle and grid 11gR2
oracle   soft   nproc    131072
oracle   hard   nproc    131072
oracle   soft   nofile   131072
oracle   hard   nofile   131072
oracle   soft   core     unlimited
oracle   hard   core     unlimited
oracle   soft   memlock  50000000
oracle   hard   memlock  50000000

The “/etc/hosts” file must contain a fully qualified name for the server.

<IP-address>  <fully-qualified-machine-name>  <machine-name>

For example.

127.0.0.1 centos6 centos6.dbaora.com localhost localhost.localdomain

Create profile .bash_profile_grid for ASM grid software in home directory /home/oracle of user oracle

# Oracle Settings
export TMP=/tmp

export ORACLE_HOSTNAME=centos6.dbaora.com
export ORACLE_UNQNAME=+ASM
export ORACLE_BASE=/ora01/app/grid
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/grid
export ORACLE_SID=+ASM

PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

alias cdob='cd $ORACLE_BASE'
alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

Create profile .bash_profile_database for database software in home directory /home/oracle of user oracle

# Oracle Settings
export TMP=/tmp

export ORACLE_HOSTNAME=centos6.dbaora.com
export ORACLE_UNQNAME=ORA11G
export ORACLE_BASE=/ora01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=ORA11G

PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

alias cdob='cd $ORACLE_BASE'
alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

in case you created both profiles as root change owner and group of both bash profiles

chown oracle:oinstall /home/oracle/.bash_profile_grid
chown oracle:oinstall /home/oracle/.bash_profile_database

Modify main profile .bash_profile of user oracle in /home/oracle

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

alias genv='. /home/oracle/.bash_profile_grid;envo'
alias denv='. /home/oracle/.bash_profile_database;envo'

. /home/oracle/.bash_profile_database
envo

So next time you do su to oracle user you should have environment prepared for database software

[root@centos6 ~]# su - oracle
ORACLE_UNQNAME=ORA11G
ORACLE_SID=ORA11G
ORACLE_BASE=/ora01/app/oracle
ORACLE_HOSTNAME=centos6.dbaora.com
ORACLE_HOME=/ora01/app/oracle/product/11.2.0/db_1
[oracle@centos6 ~]$

Number of aliases are defined in profiles to quickly managed environment

genv – sets environment for grid software

alias genv=’. /home/oracle/.bash_profile_grid;envo’

[oracle@centos6 oracle]$ genv
ORACLE_UNQNAME=+ASM
ORACLE_SID=+ASM
ORACLE_BASE=/ora01/app/grid
ORACLE_HOSTNAME=centos6.dbaora.com
ORACLE_HOME=/ora01/app/grid/product/11.2.0/grid

denv – sets environment for database software

alias denv=’. /home/oracle/.bash_profile_database;envo’

[oracle@centos6 oracle]$ denv
ORACLE_UNQNAME=ORA11G
ORACLE_SID=ORA11G
ORACLE_BASE=/ora01/app/oracle
ORACLE_HOSTNAME=centos6.dbaora.com
ORACLE_HOME=/ora01/app/oracle/product/11.2.0/db_1

cdob – change directory to $ORACLE_BASE

alias cdob=’cd $ORACLE_BASE’

cdoh – change directory to $ORACLE_HOME

alias cdoh=’cd $ORACLE_HOME’

tns – change directory to $ORACLE_HOME/network/admin

alias tns=’cd $ORACLE_HOME/network/admin’

envo – displays current environments settings and filters by ORACLE word

alias envo=’env | grep ORACLE’

[oracle@centos6 oracle]$ envo
ORACLE_UNQNAME=ORA11G
ORACLE_SID=ORA11G
ORACLE_BASE=/ora01/app/oracle
ORACLE_HOSTNAME=centos6.dbaora.com
ORACLE_HOME=/ora01/app/oracle/product/11.2.0/db_1

Check which packages are installed and which are missing

rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n' binutils \
compat-libstdc++-33 \
elfutils-libelf \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
sysstat \
unixODBC \
unixODBC-devel

Install missing packages

--it's just example
yum install unixODBC
yum install unixODBC-devel

Create directory structure

mkdir -p /ora01/app
chown oracle:oinstall /ora01/app
chmod 775 /ora01/app

oracle_base for grid software

mkdir -p /ora01/app/grid
chown -R oracle:oinstall /ora01/
chmod 775 /ora01/app/grid

oracle_base for database software

mkdir -p /ora01/app/oracle
chown oracle:oinstall /ora01/app/oracle
chmod 775 /ora01/app/oracle

Create ORACLE_HOME directories for grid and database software

mkdir -p /ora01/app/oracle/product/11.2.0/db_1
chown oracle:oinstall -R /ora01/app/oracle

mkdir -p /ora01/app/grid/product/11.2.0/grid
chown oracle:oinstall -R /ora01/app/grid

Disable secure linux by editing the “/etc/selinux/config” file, making sure the SELINUX flag is set as follows. It requires REBOOT to be effective !!!

SELINUX=disabled

Disable Firewall

Run firewall graphical manager System->Administration->Firewall and click “Disable” button. Remember to apply changes File->Apply before quit this manager.

ASM devices configuration

Oracle ASM library is not supported anymore by Oracle on RedHat6 or compatible OS like Centos 6 because of silent war between Oracle and RedHat. On the other hand ASM lib was always only optional solution. There are other alternatives which are fully supported by Oracle on ReadHat 6 and Centos 6:

  • ASM + block devices + udev naming + multipathing
  • Cluster file systems with cluster volume manager eg: gfs/clvm (RedHat), Symantec Cluster File System and Symantec Cluster Server etc
  • NFS v3 with verified NAS vendors

I’m going to present only one option NFS devices – it’s the best option to use and easy to setup for single and RAC databases. NOTE – direct NFS is not supported on RAC.

NFS configuration

Mount NFS file systems using OS kernel NFS client as user root.

mkdir /nfs_server_data
chown oracle:oinstall /nfs_server_data

add to /etc/exports

/nfs_server_data *(rw,sync,no_wdelay,insecure_locks,no_root_squash)

start nfs server

chkconfig nfs on
service nfs restart

create directory to mount /nfs_server_data

mkdir /ora01/nfs_client
chown oracle:oinstall /ora01/nfs_client

add entry to /etc/fstab file to mount /nfs_server_data on /ora01/nfs_client

centos6.dbaora.com:/nfs_server_data /ora01/nfs_client nfs rw,bg,hard,nointr,tcp,vers=3,timeo=300,rsize=32768,wsize=32768,actimeo=0  0 0

mount NFS data

mount /ora01/nfs_client

verify NFS mount

[root@centos6 ~]# df /ora01/nfs_client
Filesystem           1K-blocks      Used Available Use% Mounted on
centos6.dbaora.com:/nfs_server_data
                 61419424  36088864  22210624  62% /ora01/nfs_client

Now it’s time to create block devices over NFS

su - oracle
$ dd if=/dev/zero of=/ora01/nfs_client/asm_disk1 bs=1k count=10000000
$ dd if=/dev/zero of=/ora01/nfs_client/asm_disk2 bs=1k count=10000000

Install grid software

Start grid installation as user oracle, remember to run command xhost+ as root. Remember to set environment for grid software using alias genv.

xhost +
access control disabled, clients can connect from any host
su - oracle

--use genv alias to set environment for grid software
[oracle@centos6 ~]$ genv
ORACLE_UNQNAME=+ASM
ORACLE_SID=+ASM
ORACLE_BASE=/ora01/app/grid
ORACLE_HOSTNAME=centos6.dbaora.com
ORACLE_HOME=/ora01/app/grid/product/11.2.0/grid

--run alias command cdob and cdoh to check ORACLE_BASE, ORACLE_HOME 
[oracle@centos6 ~]$ cdob
[oracle@centos6 grid]$ pwd
/ora01/app/grid

[oracle@centos6 grid]$ cdoh
[oracle@centos6 grid]$ pwd
/ora01/app/grid/product/11.2.0/grid

--run installation form directory where you have grid software
./runInstall

1. Select “Skip software updates” and click “Next” button.

2. Select “configure Oracle Grid Infrastructure for Standalone Server” and click “Next” button.

3. Select language and click “Next” button.

4. It’s time to create ASM diskgroup DATA. So first you need to make visible ASM devices. Click “Change Discovery Path” button.

5. Enter new discovery path: /ora01/nfs_client/* and click “OK” button.

6. You should see 2 ASM devices. Select “External” Redundancy for new diskgroup and check checkbox for one device /ora01/nfs_client/asm_disk1. Click “Next” button.

7. From security point of view you should specify separate password for user SYS and ASMSNMP. I set for both user the same password. Click “Next” button.

8. In case your password is simple Oracle display following screen. Just ignore it and click “Yes” or “No” to change password to more complex.

9. You can change assignment of groups to ASM roles here. When it’s done click “Next” button. Ignore errors there is no separation for grid software and database software so groups can be the same.

10. Just click “Next” button.

11. Just click “Next” buton.

12. Oracle makes checks before installation begin. It’s the last moment to verify OS settings. In my case Oracle detected problem with pdksh package which can be safely ignored because instead ksh package is used.

13. Summary screen just before installation begin. Click “Install” button.

14. Boring installation …

15. In the “middle” of installation you will be asked to run 2 scripts as user root. when scripts are executed just click “OK” button. Installation will proceeed.

--execute scripts
/ora01/app/oraInventory/orainstRoot.sh
/ora01/app/grid/product/11.2.0/grid/root.sh

16. Installation completed. Just click “Close” button.

Install database software

Let’s start with database software installation as oracle user. Remember to set environment for database software using denv alias.

su - oracle

--use denv alias to set environment for database software
[oracle@centos6 ~]$ denv
ORACLE_UNQNAME=ORA11G
ORACLE_SID=ORA11G
ORACLE_BASE=/ora01/app/oracle
ORACLE_HOSTNAME=centos6.dbaora.com
ORACLE_HOME=/ora01/app/oracle/product/11.2.0/db_1

--run alias command cdob and cdoh to check ORACLE_BASE, ORACLE_HOME 
[oracle@centos6 ~]$ cdob
[oracle@centos6 oracle]$ pwd
/ora01/app/oracle

[oracle@centos6 oracle]$ cdoh
[oracle@centos6 db_1]$ pwd
/ora01/app/oracle/product/11.2.0/db_1

--run installation form directory where you have grid software
./runInstall

1. Uncheck checkbox “I wish to receive security updates via My Oracle Support” and click “Next” button.

2. Ignore this message and click “Yes”

3. Select “Skip software updates” and click “Next” button.

4. Select “Install database software only” and click “Next”. You can of course create database here but I want to have control how this database is created.

5. Select “Single instance database installation” and click “Next” button.

6. Select language and click “Next” button.

7. Just click “Next”

8. Just click “Next”

9. Just click “Next”

10. I ignored messages about swap by checking “Ignore All”. Then click “Next” button.

11. Ignore this message and click “Yes”

12. Start installation click “Install” button.

13. Installation in progress …

14. You need to run one script as user root. When it’s done click “OK” button.

[root@centos6 ]# /ora01/app/oracle/product/11.2.0/db_1/root.sh

15. Installation database software completed

ASM configuration assistant – ASMCA

So far we have created only one ASM group DATA. I want to show you how quickly you can add extra group to ASM instance.

As user oracle start ASMCA. Remeber to start xhost + as user root to enable run graphical tools from other users like oracle. Remember to set environment to point to grid software.

[root@centos6 ~]# su - oracle
[oracle@centos6 ~]$ genv
[oracle@centos6 ~]$ asmca

1. ASMCA started just click “Create” button.

2. Enter group name BACKUP, check checkbox for “/dev/oracleasm/disks/DISK4″ device and click “OK” button. Other devices we can use later.

3. You should see following screen. Click “OK”.

4. Now you should see we have 2 ASM groups “BACKUP” and “DATA”. Click “Exit” button.

Now you can verify in sqlplus you have 2 ASM groups.

[oracle@centos6 ~]$ sqlplus

SQL*Plus: Release 11.2.0.3.0 Production on Sun Oct 14 22:39:11 2012
Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Enter user-name: / as sysasm

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit 
Production With the Automatic Storage Management option

SQL> select name from v$asm_diskgroup;

NAME
------------------------------
DATA
BACKUP

Database configuration assistant – DBCA

As user oracle start DBCA. Remeber to start xhost + as user root to enable run graphical tools from other users like oracle. Remember to set environment for database software using denv alias.

[root@centos6 ~]# su - oracle
[oracle@centos6 ~]$ denv
[oracle@centos6 ~]$ dbca

1. Click “Next” button.

2. Just click “Next” button.

3. Just click “Next” button

4. Enter global database name and sid name.

5. Just click “Next” button.

6. From security point of view you should set separate passwords for user SYS, SYSTEM, DBSNMP, SYSMAN. You can set the same password for all users like below.

7. In case password is too simple you see below screen. You can ignore by clicking “Yes” button.

8. Select as Storage Type “Automatic Storage Management (ASM)” then click “Browse” button for Database Area.

9. Select DATA diskgroup and click “OK” button.

10. Click “Next” button.

11. You should see following screen to enter ASMSNMP password then click “OK”.

12. On this screen check checkbox “Specify fast Recovery Area” and “Enable Archiving”. It will create flashback area and turn on archivlog on database. Click “Browse” button to select ASM diskgroup for flashback.

13. Select diskgroup “BACKUP” then click “OK” button.

14. Click “Next” button.

15. Check checkbox “Sample Schemas” to install extra shemas. It’s very usefull for developers.

16. Following 4 screens shows information about our new database. You can change some settings  for the database like memory settings, initial parameters, character set of your database, change default connection type(dedicated server, shared server). Then click “Next” button.

17. Summary screen. You can review storage layout for our new database. Click “Next” button.

18. This screen enables 3 options. Select 1 and 3 option and click “Finish” button.

  • Create Database – it will create database in graphical mode.
  • Save as Database Template – it will create template which can be later used by DBCA to create similar database.
  • Generate Database Creation Scripts – it will generate scripts which can be used later to install the database in silent mode.

19. Summary screen. Click “OK” button to start installation.

20. First script for silent mode is generated. Click “OK” button to progress with installation.

21. Boring installation …

22. When it’s done you can see some interesting details for our new database.

23. You can verify new database in Database Control

Have a fun 🙂

Tomasz

4 thoughts on “Install Oracle 11G Release 2 (11.2) on Centos 6

  1. Pingback: Install Oracle On Centos 6? The 186 Correct Answer

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.