How to Install Oracle 11g R2 on RHEL-6 64 bit step by step

Pre-Installation Configurations

Check Hardware Requirements

-- Check Physical RAM.
# grep MemTotal /proc/meminfo
MemTotal:      2075424 kB
/*
 We need at least 1GB of physical RAM. 
 In my case I have 2GB.
*/

-- Check Swap Space.
# grep SwapTotal /proc/meminfo
SwapTotal:     3148732 kB

/*
 RAM between 1GB and 2GB then Swap = 1.5 times the size of RAM
 RAM between 2GB and 16GB then Swap = equal to the size of RAM
 RAM more than 16GB then Swap Size = 16GB
 Since my RAM is 2GB, so I have 3GB of Swap Size.
*/

# df -h /dev/shm/
Filesystem            Size  Used Avail Use% Mounted on
tmpfs                1014M     0 1014M   0% /dev/shm


/*
 What ever you are going to use your Automatic Memory Management 
 Targets later on this database, you need to have shared memory 
 file system size at lease equal to those settings. In my case I 
 have plans to use memory management targets lower then 1000M 
 so 1014 M of shared memory file system is sufficient for me. 
 But if you would like to have a bigger shared memory (/dev/shm) 
 size then do the following:
*/

# mount -t tmpfs tmpfs -o size=1500m /dev/shm
# df -h /dev/shm/
Filesystem            Size  Used Avail Use% Mounted on
tmpfs                 1.5G     0  1.5G   0% /dev/shm

-- Check space available in /tmp
# df -h /tmp
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda5             1.5G   35M  1.4G   3% /tmp

/* 
  You need to have at least 1GB of space in the /tmp directory.
  Make sure you have 1GB in the column "Avail" in the above output.
  In my case I have 1.4G space available in /tmp.
*/

-- Check space for Oracle Software and pre configured database.
-- I have created a separate partition "/u01" for Oracle Software 
-- and database files
# df -h /u01
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              15G  166M   14G   2% /u01

-- I have 14G available space on the partition /u01.
/*
  Space requirement for Oracle 11g Release 2 Software:
     Enterprise Edition      3.95G
     Standard Edition       3.88G
  
  Space requirement for Oracle Database Files:
     1.7 G 
     (
      creating a database is always optional with oracle installation. 
      Can be done later.
     )
*/

/*
 To install Oracle 11g Release 2 your system should be running
 on at least 1024x768 screen resolution.
*/
# xdpyinfo | grep 'dimensions:'
  dimensions:    1280x720 pixels (433x244 millimeters)

/*
 To install Oracle 11g Release 2 on RHEL 5 you should be running
 a kernel version 2.6.18 or later.
*/
# uname -r
2.6.18-194.el5

Note: Here Oracle 11g R2 Installation a briefly guide on Redhat Linux 6 (64 bit). In this article discus about Oracle 11g (R2) Database server for this server minimum 2 GB swap size and selinux=permissive. For Linux Installation see my Linux Installation post.


Step 1.
Download Oracle Database Software from Oracle website, it is download in two parts zip file. Then unzip these both file after unzip these file making a single database folder. For unzip follow below steps.
Unzip Files
[root@localhost ~]# mkdir /u01
cd /media/name of USB/
[root@localhost ~]# cd /media/KHALIL/
[root@localhost KHALIL]# ls
linux_11gR2_database_2of2.zip  Oracle 11gR2_11.2.4_64bit
Oracle 11gR2_11.02.01_64bit    System Volume Information
[root@localhost KHALIL]# cd /media/KHALIL/Oracle\ 11gR2_11.2.4_64bit/
[root@localhost Oracle 11gR2_11.2.4_64bit]# ls
linux.x64_11gR2_database_1of2.zip  linux.x64_11gR2_database_2of2.zip
[root@localhost Oracle 11gR2_11.2.4_64bit]# unzip linux.x64_11gR2_database_1of2.zip -d/u01
[root@localhost Oracle 11gR2_11.2.4_64bit]# unzip linux.x64_11gR2_database_2of2.zip -d/u01
Now you have a single Database folder which is have runInstaller file.


Step 2.
Edit Hosts File:
In the Hosts file you have to fully specify your hostname and your machine IP address.
[root@localhost ~]# vi /etc/hosts       (hit enter then press I for insert mode then edit it)
For Example.
[IP-address] [fully-qualified-machine-name] [machine-name]
[192.168.10.100] [localhost.localdomain] [localhost]
After update this file press Esc then shif+: then wq  then Enter. 

Open the “/etc/sysconfig/network” file and modify the HOSTNAME to match your FQDN (Fully Qualified Domain Name) host name.
[root@oracle]# vi /etc/sysconfig/network
HOSTNAME=localhost.localdomain
Now you need to restart networking on the server to make sure that changes will be persistent on reboot.

[root@oracle]# /etc/init.d/network restart
Add the entry to file “/etc/security/limits.d/90-nproc.conf” as described below.
[root@oracle]# vi /etc/security/limits.d/90-nproc.conf

# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.

*          soft    nproc     1024
# To this
* - nproc 16384
Step 3.
Edit /etc/sysctl.conf file and add below parameter in end of this file.
[root@localhost ~]# vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
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
After that run below command for applying changes of sysctl file.
[root@localhost ~]# /sbin/sysctl -p
Step 4.
Now Edit /etc/security/limits.conf and add following lines in end of this file.
[root@localhost ~]# vi /etc/security/limits.conf
oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  4096
oracle              hard    nofile  65536
oracle              soft    stack   10240
Step 5.
Now Edit /etc/pam.d/login file and end following parameter
[root@localhost ~]# vi /etc/pam.d/login
session    required     pam_limits.so
Step 6.
Now install required packages for configuring Oracle Database for installing these rpm using YUM server for yum server configuration see my yum server configuration post.
yum install binutils -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y
yum install zlib-devel -y
yum install elfutils-libelf-devel -y
Step 7.
Now add some group and add a user for Oracle installation.
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
useradd -g oinstall -G dba,oper oracle
passwd oracle
Step 8.
Now create a Directory and change  directory permissions
mkdir -p /u01/app/oracle/product/11.2.0.4/db_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01
Step 9.
Now set selinux=permissive
[root@localhost ~]# vi /etc/selinux/config
Step 10.
Now make firewall disabled using setup command. Following below steps.
 #setup -- firewall configuration--disable
Step 11.
Now connect you oracle user using su command then open .bash_profile command and add following command in end of file.
[root@localhost ~]#su – oracle
[oracle@localhost ~]$ vi .bash_profile
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP;

export TMPDIR
ORACLE_HOSTNAME=rhel6.localdomain; export ORACLE_HOSTNAME
ORACLE_UNQNAME=db11g; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/db_1; export ORACLE_HOME
ORACLE_SID=db11g; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH

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

if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
Step 12.
Now reboot your pc and login with Oracle user and follow below steps.
[oracle@localhost ~]$ su - root
Password:
[root@localhost ~]# reboot


Switch to root user and issue the following command to allow Oracle user to access X Server.
[root@oracle]# xhost +
$cd /u01/database

$./runInstaller
Then following graphically steps. If you got any error related to pdksh rpm than download this rpm file from internet and install it than try again.
AFTER INSTALLATION WORK

Automating Database Startup and Shutdown on Linux
The following represents the Oracle recommended method for automating database startup and shutdown of Oracle 9i instances on Linux, but it works equally well for Oracle 10g, 11G and 12c also. It can be used on any RHEL-style distribution, including Oracle Linux, up to an including RHEL6.

Once the instance is created, edit the "/etc/oratab" as the root user, file setting the restart flag for each instance to 'Y'.
TSH1:/u01/app/oracle/product/9.2.0:Y

Next, create a file called "/etc/init.d/dbora" as the root user, containing the following.

This method can still be used under Oracle 10g, 11g and 12c, provided the "ORA_HOME" variable is amended to use the correct path and this is added to the end of the dbstart and dbshut lines. The lines to start and stop the listener can be removed under Oracle 10g Release 2 onward, as the dbstart command includes an automatic start of the listener.

#!/bin/sh
# chkconfig: 345 99 10
# description: Oracle auto start-stop script.
#
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the 
# Oracle database in ORA_HOME.

#ORA_HOME=/u01/app/oracle/product/10.2.0/db_1
#ORA_HOME=/u01/app/oracle/product/11.1.0/db_1
#ORA_HOME=/u01/app/oracle/product/11.2.0/db_1
ORA_HOME=/u01/app/oracle/product/11.2.0.4/db_1
ORA_OWNER=oracle
export ORACLE_UNQNAME=db12c

if [ ! -f $ORA_HOME/bin/dbstart ]
then
    echo "Oracle startup: cannot start"
    exit
fi

case "$1" in
    'start')
        # Start the Oracle databases:
        # The following command assumes that the oracle login 
        # will not prompt the user for any values
        su $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME"
        touch /var/lock/subsys/dbora
        ;;
    'stop')
        # Stop the Oracle databases:
        # The following command assumes that the oracle login 
        # will not prompt the user for any values
        su $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME"
        rm -f /var/lock/subsys/dbora
        ;;
esac

Use the chmod command to set the privileges to 750.

# chmod 750 /etc/init.d/dbora

Create symbolic links to the dbora script in the appropriate run-level script directories as follows.

# ln -s /etc/init.d/dbora /etc/rc.d/rc0.d/K01dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora

Next, we must create the "startup.sh" and "shutdown.sh" scripts in the "/home/oracle/scripts". First create the directory.
# mkdir -p /home/oracle/scripts
# chown oracle.oinstall /home/oracle/scripts

The "/home/oracle/scripts/startup.sh" script should contain the following commands.

#!/bin/bash

export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/u01/app/oracle
#export ORACLE_HOSTNAME=ol6-112.localdomain
#export ORACLE_UNQNAME=DB11G
#export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_HOSTNAME=ol6-121.localdomain
export ORACLE_UNQNAME=db12c
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/db_1
export PATH=/usr/sbin:$ORACLE_HOME/bin:$PATH

export ORACLE_SID=db12c
ORAENV_ASK=NO
. oraenv
ORAENV_ASK=YES

# Start Listener
lsnrctl start

# Start Database
sqlplus / as sysdba << EOF
STARTUP;
EXIT;
EOF

The "/home/oracle/scripts/shutdown.sh" script is similar.

#!/bin/bash

export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/u01/app/oracle
#export ORACLE_UNQNAME=DB11G
#export ORACLE_HOSTNAME=ol6-112.localdomain
#export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_HOSTNAME=ol6-121.localdomain
export ORACLE_UNQNAME=db12c
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/db_1
export PATH=/usr/sbin:$ORACLE_HOME/bin:$PATH

export ORACLE_SID=db12c 
ORAENV_ASK=NO
. oraenv
ORAENV_ASK=YES

# Stop Database
sqlplus / as sysdba << EOF
SHUTDOWN IMMEDIATE;
EXIT;
EOF

# Stop Listener
lsnrctl stop

Note. You could move the environment settings into the "dbora" file or into a separate file that is sourced in the startup and shutdown script. I kept it local to the script so you could see the type of things that need to be set in case you have to write a script to deal with multiple installations, instances and listeners.

Make sure the permissions and ownership of the files is correct.

# chmod u+x /home/oracle/scripts/startup.sh /home/oracle/scripts/shutdown.sh
# chown oracle.oinstall /home/oracle/scripts/startup.sh /home/oracle/scripts/shutdown.sh


Restart your system and you will see the listener and database will now start and stop automatically with the machine. You may test as follows:

login as: oracle
oracle@192.168.1.200's password:
Last login: Wed Feb  6 05:10:13 2013 from 192.168.1.141
[oracle@localhost ~]$ sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 6 05:24:31 2013

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

Enter user-name: / as sysdba

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Sharing Files between RHEL 6 and Windows Systems with Samba
For more

No comments:

Post a Comment