Install Oracle 11G Release 2 (11.2) on Oracle Linux 6 (OEL6)

This article presents installation of Oracle 11.2.0.3 on OEL6.

Read following article to install OEL6 Linux: Install Oracle Linux 6 64 bit(for comfort set 2G memory for your virtual machine). During OEL6 installation I drop user oracle and both group dba and oinstall.

11.2.0.3 installation guide presents full separation of grid and oracle user.

Add groups

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

Privileges and Groups for ASM
ASM privileges - SYSASM, SYSOPER, SYSDBA. 

SYSASM - provides full administration privileges for ASM instance.
SYSDBA - provides access to ASM disk. It's just subset of SYSASM. 
         Used to separate grid user from oracle.         
SYSOPER - it's subset of SYSASM so enables subset of administration 
privileges like startup/shutdown/mount/dismount/check diskgroup

Above privileges are granted to a given users by unix groups
ASM groups - ASMADMIN, ASMDBA, ASMOPER

ASMADMIN - grants ASM privilege SYSASM
ASMDBA - grants ASM privilege SYSDBA
ASMOPER - grants ASM privilege SYSOPER

NOTE - user oracle has got ASMDBA group so gets ASM privilege SYSDBA 
       to be able to read/write asm devices.
Remember don't mix ASM SYSDBA(granted by group ASMDBA) with 
Oracle SYSDBA(granted by group dba). For example user grid has got 
group ASMDBA but is not able to restart oracle instance but just asm
instance. Group dba can be granted to grid user if you want to use
Oracle Restart feature.

Change password for users

passwd oracle
passwd grid
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
grid    soft    nproc    131072
grid    hard    nproc    131072
grid    soft    nofile   131072
grid    hard    nofile   131072
grid    soft    core     unlimited
grid    hard    core     unlimited
grid    soft    memlock  50000000
grid    hard    memlock  50000000

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   oel6 oel6.dbaora.com localhost localhost.localdomain

Create .bash_profile for user grid

# Oracle Settings
export TMP=/tmp

export ORACLE_HOSTNAME=oel6.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 .bash_profile for user oracle

# Oracle Settings
export TMP=/tmp

export ORACLE_HOSTNAME=oel6.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

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:

#directory with mounted Oracle Enterprise Linux 6 install disk

cd /media/OL6.2 x86_64 Disc 1 20111212/Server/Packages

#install missed packages (example for package unixODBC*)

rpm -Uvh unixODBC*

Create directory structure

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

ORACLE_BASE for grid

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

ORACLE_BASE for oracle

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

Create ORACLE_HOME directories for grid and oracle

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 grid: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.

It’s time to add ASM disks to our host. There are 2 options:

  1. create dummy loopback device to simulate our drive
  2. add new drive to virtual machine dedicated for ASM

Option number 1 – add loopback device

--create directory for loopback devices
mkdir /asmdisks
--create dummy files
dd if=/dev/zero of=/asmdisks/disk1 bs=1024k count=5120
dd if=/dev/zero of=/asmdisks/disk2 bs=1024k count=5120
--change owner and group for grid user
chown -R grid:asmdba /asmdisks
--check privileges
ls -la /asmdisks

total 10485776
drwxr-xr-x   2 grid asmdba       4096 Oct  7 14:15 .
dr-xr-xr-x. 28 root root         4096 Oct  7 14:14 ..
-rw-r--r--   1 grid asmdba 5368709120 Oct  7 14:15 disk1
-rw-r--r--   1 grid asmdba 5368709120 Oct  7 14:16 disk2
--create loopback devices and check them
losetup /dev/loop1 /asmdisks/disk1
losetup /dev/loop2 /asmdisks/disk2

losetup -a
/dev/loop1: [fc00]:655363 (/asmdisks/disk1)
/dev/loop2: [fc00]:655364 (/asmdisks/disk2)
--configure ASM lib driver
/etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting <ENTER> without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface []: grid
Default group to own the driver interface []: asmdba
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver:                     [  OK  ]
Scanning the system for Oracle ASMLib disks:               [  OK  ]
--create asm devices
oracleasm createdisk DISK1 /dev/loop1
oracleasm createdisk DISK2 /dev/loop2
--check asmdisks
oracleasm listdisks
DISK1
DISK2

Add the following entries to the file “/etc/rc.local”

/sbin/losetup /dev/loop1 /asmdisks/disk1
/sbin/losetup /dev/loop2 /asmdisks/disk2
/etc/init.d/oracleasm createdisk DISK1 /dev/loop1
/etc/init.d/oracleasm createdisk DISK2 /dev/loop2
/etc/init.d/oracleasm scandisks

Option number 2 – add dedicated disks

I assume you can add disk to virtual machine and you can find it under unix. For my tests I added 20G disk to my virtual machine. It’s visible in Linux as /dev/sdb device.

--add 2 new partitions to /dev/sdb
fdisk /dev/sdb

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): +10G

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (1307-2610, default 1307): 
Using default value 1307
Last cylinder, +cylinders or +size{K,M,G} (1307-2610, default 2610): 
Using default value 2610

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
--List new partitions
fdisk -l /dev/sdb

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1306    10490413+  83  Linux
/dev/sdb2            1307        2610    10474380   83  Linux
--Map new partitions to asm library
oracleasm createdisk DISK3 /dev/sdb1
Writing disk header: done
Instantiating disk: done

oracleasm createdisk DISK4 /dev/sdb2
Writing disk header: done
Instantiating disk: done
--List all ASM disks
oracleasm listdisks
DISK1
DISK2
DISK3
DISK4

ll /dev/oracleasm/disks/
total 0
brw-rw---- 1 grid asmdba 7,  1 Oct  5 21:24 DISK1
brw-rw---- 1 grid asmdba 7,  2 Oct  5 21:24 DISK2
brw-rw---- 1 grid asmdba 8, 17 Oct  5 21:08 DISK3
brw-rw---- 1 grid asmdba 8, 18 Oct  5 21:08 DISK4

Start grid installation as user grid, remember to run command xhost+ as root.

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

--I defined 4 aliases in .bash_profile of user grid to make 
--administration heaven :)
[grid@oel6 ~]$ alias envo cdob cdoh tns
alias envo='env | grep ORACLE'
alias cdob='cd $ORACLE_BASE'
alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'

--run alias command envo to display environment settings
envo
ORACLE_UNQNAME=+ASM
ORACLE_SID=+ASM
ORACLE_BASE=/ora01/app/grid
ORACLE_HOSTNAME=oel6.dbaora.com
ORACLE_HOME=/ora01/app/grid/product/11.2.0/grid

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

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

--run installation
./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 langauge 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: /dev/oracleasm/disks/* and click “OK” button.

6. You should see 4 ASM devices. Select “External” Redundancy for new diskgroup and check checkbox for one device /dev/oracleasm/disks/DISK3. 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.

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 that swap is “too small”. You can change it and click “Check Again” or like in my case check checkbox “Ignore All” and click “Next” button. 2GB of ram and almost 2GB of swap is more than enough to proceed with installation.

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.

After this installation you can increase swap to 4GB.

Install database software

Let’s start with database software installation as oracle user

su - oracle

--I defined 4 aliases in .bash_profile of user oracle to make 
--administration heaven :)

[oracle@oel6 ~]$ alias envo cdob cdoh tns
alias envo='env | grep ORACLE'
alias cdob='cd $ORACLE_BASE'
alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'

--run alias command envo to display environment settings
envo
ORACLE_UNQNAME=ORA11G
ORACLE_SID=ORA11G
ORACLE_BASE=/ora01/app/oracle
ORACLE_HOSTNAME=oel6.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@oel6 ~]$ cdob
[oracle@oel6 oracle]$ pwd
/ora01/app/oracle

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

--run installation
./runInstall

1. Uncheck checkbox “I wish to recive 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@oel6 oracle]# /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 grid start ASMCA. Remeber to start xhost + as user root to enable run graphical tools from other users like grid, oracle.

[root@oel6 ~]# su - grid
[grid@oel6 ~]$ 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.

[grid@oel6 ~]$ 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 grid, oracle.

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 our 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

7 thoughts on “Install Oracle 11G Release 2 (11.2) on Oracle Linux 6 (OEL6)

  1. Hi Tomasz,

    Good Explanation. Help me a lot. One Suggestion, instead of using dummy loop back devices. You can use the real disk or VMWare disk.

    • Hi Joshua

      It’s quite old article in the latest installation articles I’m not using any more loopback devices.

      Regards
      Tomasz

    • Hi Joshua

      Not yet but I’ll think about it :). Can you suggest what would you like to have in such article ? I assume configuration: logical, physical, switchover, failover, dgmrl, backup & restore, flashback. What else ?

      Kind Regards
      Tomasz

  2. i got a problem with the 2nd grid script because “ohasd failed to start Inappropriate ioctl for device at roothas.pl” at Oracle Linux 6.5
    if some1 else got this problem, here is the solution that worked for me:
    https://community.oracle.com/message/10481231#10481231

    and i got a improvement:
    the Oracle Net Configuration Assistant refused to work properly at my installation because i got sereval entries in my /etc/hosts file in the same line. so its better to write every entry in a new line:
    127.0.0.1 localhost
    127.0.0.1 localhost.localdomain
    etc.

    regards
    Judas

Leave a Reply to admin Cancel 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.