Monday, February 11, 2013

Installing Oracle 11g R2 RAC on Linux


Software
Oracle Enterprise Linux 5 update 5 x86_64
Oracle 11g Release 2 (11.2) (64 bit)
VMWare Server 2

-----------------------------------------------------------------------------------------
Virtual Machine Setup



















 ------------------------------------------------------------------------------------------------------------

Guest Operating System Installation

Place the first OEL 5 disk in the DVD drive and start the virtual machine by clicking the play button on the toolbar.














































------------------------------------------------------------------------------------------------------------
Install VMware Client Tools

On the web console, highlight the "RAC1" VM and click the "Install VMware Tools" link and click the subsequent "Install" button.














-------------------------------------------------------------------------------------------
Linux Configuration for Oracle RAC

Once the basic installation is complete, install the following packages whilst logged in as the root user. This includes the 64-bit and 32-bit versions of some packages.

# From Enterprise Linux 5 DVD

cd /media/cdrom/Server


rpm -Uvh binutils-2.*
rpm -Uvh compat-libstdc++-33*
rpm -Uvh elfutils-libelf-0.*
rpm -Uvh elfutils-libelf-devel-*
rpm -Uvh gcc-4.*
rpm -Uvh gcc-c++-4.*
rpm -Uvh glibc-2.*
rpm -Uvh glibc-common-2.*
rpm -Uvh glibc-devel-2.*
rpm -Uvh glibc-headers-2.*
rpm -Uvh ksh-2*
rpm -Uvh libaio-0.*
rpm -Uvh libaio-devel-0.*
rpm -Uvh libgcc-4.*
rpm -Uvh libstdc++-4.*
rpm -Uvh libstdc++-devel-4.*
rpm -Uvh make-3.*
rpm -Uvh sysstat-7.*
rpm -Uvh unixODBC-2.*
rpm -Uvh unixODBC-devel-2.*

Determine your current kernel.

uname -rm
2.6.18-164.el5 x86


(This is my Linux Kernel Version, your might be different, download software related to your kernel)

Check if following packages are installed on your machine otherwise install download a version of package which is compatible with your Operating system version and Kernel.

[root@rac1 ~]# rpm -qa | grep oracleasm*
oracleasm-2.6.18-238.el5debug-2.0.5-1.el5
oracleasm-2.6.18-238.el5-2.0.5-1.el5
oracleasm-support-2.1.4-1.el5
[root@rac1 ~]# rpm -qa | grep kernel-debug*
kernel-debug-2.6.18-238.el5

If you are using Oracle Enterprise Linux then you can find these package in Linux Installation CD


# For OEL, use relevant versions of the following packages from your media.

rpm -Uvh oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm \
oracleasm-support-2.1.3-1.el5.x86_64.rpm \
oracleasm-2.6.18-238.el5debug-2.0.5-1.el5

Oracle Installation Prerequisites

Perform the following steps whilst logged into the RAC1 virtual machine as the root user.

Make sure the shared memory filesystem is big enough for Automatic Memory Manager to work.

# umount tmpfs
# mount -t tmpfs shmfs -o size=1500m /dev/shm

Make the setting permanent by amending the "tmpfs" setting of the "/etc/fstab" file to look like this.

tmpfs                   /dev/shm                tmpfs   size=1500m      0 0



If you are not using DNS, the "/etc/hosts" file must contain the following information.



127.0.0.1 localhost

# Public

132.35.21.177 rac1.rrm.gov rac1
132.35.21.178 rac2.rrm.gov rac2

# Private
10.10.10.1 rac1-priv.rrm.gov rac1-priv
10.10.10.2 rac2-priv.rrm.gov rac2-priv

# Virtual
132.35.21.187 rac1-vip.rrm.gov rac1-vip
132.35.21.188 rac2-vip.rrm.gov rac2-vip

# Scan
132.35.21.198 rac-scan.rrm.gov rac-scan


Note. The SCAN address should not really be defined in the hosts file. Instead is should be defined on the DNS to round-robin between 3 addresses on the same subnet as the public IPs. For this installation, we will compromise and use the hosts file. This approach will not work with 11.2.0.2 onwards. Instead you should use the DNS.
If you are using DNS, then only the first line need be present in the "/etc/hosts" file.

Add or amend the following lines to the "/etc/sysctl.conf" file.
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 1054504960
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

Run the following command to change the current kernel parameters.

/sbin/sysctl -p


Add the following lines to the "/etc/security/limits.conf" file. 

oracle soft nproc 2047
oracle hard nproc 16384
oracle  soft  nofile  1024
oracle  hard  nofile  65536

Add the following lines to the "/etc/pam.d/login" file, if it does not already exist.

session required pam_limits.so

Disable secure linux by editing the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows.
SELINUX=disabled

Alternatively, this alteration can be done using the GUI tool (System > Administration > Security Level and Firewall). Click on the SELinux tab and disable the feature. 

deconfigure NTP.

service ntpd stop

Shutting down ntpd:                                        [  OK  ]


chkconfig ntpd off
mv /etc/ntp.conf /etc/ntp.conf.org
rm /var/run/ntpd.pid


Create the new groups and users. 


groupadd -g 1000 oinstall
groupadd -g 1200 dba
useradd -u 1100 -g oinstall -G dba oracle
passwd oracle

Create the directories in which the Oracle software will be installed. 


mkdir -p /u01/app/11.2.0/grid
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01/


Login as the oracle user and add the following lines at the end of the ".bash_profile" file. 

# User specific environment and startup programs

#oracle settings

TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
GRID_HOME=/u01/app/11.2.0/grid; export GRID_HOME
PATH=$PATH:$HOME/bin:/usr/sbin:$ORACLE_HOME/bin:$GRID_HOME/bin export PATH
ORACLE_HOSTNAME=rac1.rrm.gov; export ORACLE_HOSTNAME
ORACLE_UNQNAME=RAC; export ORACLE_UNQNAME
ORACLE_SID=RAC1; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
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

alias grid_env='. /home/oracle/grid_env'
alias db_env='. /home/oracle/db_env'



Create a file called "/home/oracle/grid_env" with the following contents.


ORACLE_SID=+ASM1; export ORACLE_SID
ORACLE_HOME=$GRID_HOME; export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$BASE_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


Create a file called "/home/oracle/db_env" with the following contents.


ORACLE_SID=RAC1; export ORACLE_SID
ORACLE_HOME=$DB_HOME; export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$BASE_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



Once the "/home/oracle/grid_env" has been run, you will be able to switch between environments as follows.


$ grid_env
$ echo $ORACLE_HOME
/u01/app/11.2.0/grid

Switch environment

$ db_env
$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/db_1
$







Create a Folder for Shared ASM Disks












Clone and create Second node RAC2. Copy / Paste RAC1 to same location and rename folder to RAC2 then edit following line in RAC1.vmx file


Add Virtual Machine to inventory and Start it









Grid Infrastructure Installation



























































No comments:

Post a Comment