Oracle RAC 11gR2 Installation on Virtual Box

Installing oracle rac 11g on linux, Oracle RAC 11gR2 Installation on Virtual Box

Installation of Oracle Enterprise Linux 5.7 by clicking on the link

Linux Post Installation Steps:

To be consistent with the rest of the article, the following information should be set during the installation process.

#vi /etc/hosts

127.0.0.1 localhost.localdomain localhost
# Public
192.168.1.101 rac1.oracle.com rac1
192.168.1.109 rac2.oracle.com rac2
# Private
192.168.0.101 rac1-priv.oracle.com rac1-priv
192.168.0.102 rac2-priv.oracle.com rac2-priv
# Virtual
192.168.1.111 rac1-vip.oracle.com rac1-vip
192.168.1.112 rac2-vip.oracle.com rac2-vip
# SCAN
192.168.1.113 rac-scan.oracle.com rac-scan

Do the Network Configuaration as shown below usin neat command as a root user

[root@localhost Server]#neat

Select etho and click on “Edit”

Click “OK” and then select DNS Tab

Then select “Devices” tab and click “Activate”.  Once it is done, select eth1

Select “eth1” and then select Edit

Then select “Devices” tab and Click “Activate” and then do the “service network restart”

# umount tmpfs

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

ake the setting permanent by amending the “tmpfs” setting of the “/etc/fstab” file to look like this.

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

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.

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/

Either configure NTP, or make sure it is not configured so the Oracle Cluster Time Synchronization Service (ctssd) can synchronize the times of the RAC nodes. If you want to deconfigure NTP do the following.

# service ntpd stop
Shutting down ntpd: [ OK ]
# chkconfig ntpd off
# mv /etc/ntp.conf /etc/ntp.conf.orig
If you want to use NTP, you must add the “-x” option into the following line in the “/etc/sysconfig/ntpd” file.

##############################################
Drop root to id ‘ntp:ntp’ by default.
OPTIONS=”-x -u ntp:ntp -p /var/run/ntpd.pid”
##############################################

# mv /etc/ntp.conf.orig /etc/ntp.conf

# service ntpd start

[root@localhost Server]# service ntpd status
ntpd (pid 4805) is running…
[root@localhost Server]#

Login as the “oracle” user and add the following lines at the end of the “/home/oracle/.bash_profile” file.

# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_HOSTNAME=rac1.oracle.com; export ORACLE_HOSTNAME
ORACLE_UNQNAME=RAC; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
GRID_HOME=/u01/app/11.2.0/grid; export GRID_HOME
DB_HOME=$ORACLE_BASE/product/11.2.0/db_1; export DB_HOME
ORACLE_HOME=$DB_HOME; export ORACLE_HOME
ORACLE_SID=RAC1; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
BASE_PATH=/usr/sbin:$PATH; export BASE_PATH
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

if [ $USER = “oracle” ]; then
if [ $SHELL = “/bin/ksh” ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi

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
$ db_env
$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/db_1
$
We’ve made a lot of changes, so it’s worth doing a reboot of the VM at this point to make sure all the changes have taken effect.

# shutdown -r now

Create Shared Disks

Shut down the “rac1.oracle.com” virtual machine using the following command.

# shutdown -h now

On RAC1, create 4 sharable virtual disks.

Click on Sata Controller second + button and select “Create New Disk”

Select VDK and click Next

Select Fixed Size

Select Location and size for asm disk

Select Create

Go to File menu and select Virtual Media Manager

Select asm1.vdi and select modify

Select “Shareable”  and click ok

Do the same and add asm2.vdk,asm2.vdk, and asm4.vdk disks to virtual box

Start the “rac1” virtual machine by clicking the “Start” button on the toolbar. When the server has started, log in as the root user so you can configure
the shared disks. The current disks can be seen by issuing the following commands.

# cd /dev
# ls sd*
sda sda1 sda2 sdb sdc sdd sde sdf
#

Use the “fdisk” command to partition the disks sdb to sdf. The following output shows the expected fdisk output for the sdb disk.

# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won’t be recoverable.

The number of cylinders for this disk is set to 1305.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):
Using default value 1305

Command (m for help): p

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 1305 10482381 83 Linux

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

Calling ioctl() to re-read partition table.
Syncing disks.
#
In each case, the sequence of answers is “n”, “p”, “1”, “Return”, “Return”, “p” and “w”.

Once all the disks are partitioned, the results can be seen by repeating the previous “ls” command.

# cd /dev
# ls sd*
sda sda1 sda2 sdb sdb1 sdc sdc1 sdd sdd1 sde sde1 sdf sdf1
#

Configure ASMLib using the following command.

# oracleasm configure -i
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 []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: done
#
Load the kernel module using the following command.

# /usr/sbin/oracleasm init
Loading module “oracleasm”: oracleasm
Mounting ASMlib driver filesystem: /dev/oracleasm
#
If you have any problems, run the following command to make sure you have the correct version of the driver.

# /usr/sbin/oracleasm update-driver
Mark the five shared disks as follows.

# /usr/sbin/oracleasm createdisk DISK1 /dev/sdb1
Writing disk header: done
Instantiating disk: done
# /usr/sbin/oracleasm createdisk DISK2 /dev/sdc1
Writing disk header: done
Instantiating disk: done
# /usr/sbin/oracleasm createdisk DISK3 /dev/sdd1
Writing disk header: done
Instantiating disk: done
# /usr/sbin/oracleasm createdisk DISK4 /dev/sde1
Writing disk header: done
Instantiating disk: done
#
It is unnecessary, but we can run the “scandisks” command to refresh the ASM disk configuration.

# /usr/sbin/oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks…
Scanning system for ASM disks…
#
We can see the disk are now visible to ASM using the “listdisks” command.

# /usr/sbin/oracleasm listdisks
DISK1
DISK2
DISK3
DISK4
#
The shared disks are now configured for the grid infrastructure.

Clone the Virtual Machine

Later versions of VirtualBox allow you to clone VMs, but these also attempt to clone the shared disks, which is not what we want. Instead we must manually
clone the VM.

Shut down the “vboxrac1” virtual machine using the following command.

# shutdown -h now

Manually clone the vboxrac1.vdi disk using the following commands on the host server.

$ cd C:\Program Files\Oracle\VirtualBox
$ VBoxManage clonehd E:\vboxrac1\vboxrac1.vmdk E:\vboxrac2\vboxrac2.vmdk

Create the “vboxrac2” virtual machine in VirtualBox in the same way as you did for “vboxrac1”, with the exception of using an existing “vboxrac2.vdi”
virtual hard drive.

Start the “vboxrac2” virtual machine by clicking the “Start” button on the toolbar. Ignore any network errors during the startup.

Log in to the “vboxrac2” virtual machine as the “root” user so we can reconfigure the network settings to match the following.

hostname: rac2.oracle.com
IP Address eth1: 192.168.1.109 (public address)
Default Gateway eth1: 192.168.1.1 (public address)
IP Address eth0: 192.168.0.102 (private address)
Default Gateway eth0: none

Edit the “/home/oracle/.bash_profile” file on the “vboxrac2” node to correct the ORACLE_SID and ORACLE_HOSTNAME values.

ORACLE_SID=RAC2; export ORACLE_SID
ORACLE_HOSTNAME=rac2.oracle.com; export ORACLE_HOSTNAME

Also, amend the ORACLE_SID setting in the “/home/oracle/db_env” and “/home/oracle/grid_env” files.

Restart the “vboxrac2” virtual machine and start the “vboxrac1” virtual machine. When both nodes have started, check they can both ping all the public and private IP addresses using the following commands.

ping -c 3 rac1
ping -c 3 rac1-priv
ping -c 3 rac2
ping -c 3 rac2-priv

At this point the virtual IP addresses defined in the “/etc/hosts” file will not work, so don’t bother testing them.

Check the candidate ASM disks are visible on the second node using the “listdisks” command. If you are not able to see the DISKS then you may need to repeat the ASMLib configuration on the second node if the output of the following command is not consistent on both nodes.

# /usr/sbin/oracleasm listdisks
DISK1
DISK2
DISK3
DISK4
#

The virtual machine setup is now complete

Before moving forward you should probably shut down your VMs and take backups of them. If any failures happen beyond this point it is probably better to switch back to those backups,cleanup the shared disks and start the grid installation again. An alternative to cleaning up the shared disks is to back them up now using zip and just replace them in the event of a failure.

Install the Grid Infrastructure

Make sure the “vboxrac1” and “vboxrac2” virtual machines are started, then login to “vboxrac1” as the oracle user and start the Oracle installer.

$ cd /home/oracle/sw/grid
$ ./runInstaller

Leave a Reply

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