In this article , I have described each and every step required for setting up a 2 node rac 12c database using virtual box for testing purpose.

Softwares Required:

1. Virtual box :

2. Linux 

3. Oracle 12c home:

4. Oracle 12c Grid:

Virtual Machine setup:

Here we have to setup 2 nodes inside virtual box. So reduce our work, we will build one node and then clone the same to other node.

1. Open virtual box

1

2

3

4

5

6

7

8

 

 

9

 

3. Choose the linux iso file for installation:

10

11

12

 

4.Start the linux installation:

13

14

15

16

17

18

19

20

21

22

23

24

25

26

28

29

30

31

32

33

34

35

 

 

After selecting Server administrative tools, click on OPTIONAL PACKAGES.  Make sure you select oracle rdbms and oracleasm packages.

 

36 37

38

39

40

41

42

 

Now your linux installation is done .

5. Install guest addition 

Guest addition  helps in keyboard and mouse integration.

 

43

44

 

 

45

46

 

6. Configure oracleasm lib.

47

 

7.Go to settings and change both to bidirectional.

48

8.Now create user groups and set password for oracle user:

[root@riyadh1 ~]# mkdir -p /u01/app/12.1.0/grid_1
[root@riyadh1 ~]# mkdir -p /u01/app/oracle
[root@riyadh1 ~]# chown -R oracle:oinstall /u01
[root@riyadh1 ~]# chown oracle:oinstall /u01/app/oracle
[root@riyadh1 ~]# chmod -R 775 /u01/
[root@riyadh1 ~]# usermod -G dba,vboxsf oracle
[root@riyadh1 ~]# 
[root@riyadh1 ~]# 
[root@riyadh1 ~]# 
[root@riyadh1 ~]# 
[root@riyadh1 ~]# passwd oracle
Changing password for user oracle.
New password: 
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@riyadh1 ~]#

9.Now disable the firewall:

Go to SYSTEM – > ADMINISTRATION -> FIREWALL

 

49

50

 

10.Disable selinux mode to disable from enabled in config file.

vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

11.Stop ntpd services:

[root@riyadh1 ~]# service ntpd stop
 Shutting down ntpd: [FAILED]
 [root@riyadh1 ~]# chkconfig ntpd off
 [root@riyadh1 ~]# mv /etc/ntp.conf /etc/ntp.conf.orig

 

[root@riyadh1 ~]# yum clean all
 Loaded plugins: refresh-packagekit, security
 Cleaning repos: ol6_UEK_latest ol6_latest
 Cleaning up Everything
 [root@riyadh1 ~]#

 

Now we have to make the grid and oracle home software shareable with the virtual box. Shutdown the node1.

51

52

53

 

Once done start the node1 and login with oracle user.

 

[oracle@riyadh1 ~]$ su – root
Password:
[root@riyadh1 ~]# cd /media/sf_oracle_sw/
[root@riyadh1 sf_oracle_sw]# pwd
/media/sf_oracle_sw
[root@riyadh1 sf_oracle_sw]# ls -ltr
total 8
drwxrwx— 1 root vboxsf 4096 Jul 7 2014 grid
drwxrwx— 1 root vboxsf 4096 Mar 1 10:14 database
[root@riyadh1 sf_oracle_sw]#

 

Install cvfudisk:

Without cvuqdisk, Cluster Verification Utility is unable to discover shared disks, and you receive the error message “Package cvuqdisk not installed” when you run Cluster Verification Utility. Use the cvuqdisk rpm for your hardware (for example, x86_64, or i386).

 [root@riyadh1 sf_oracle_sw]# cd /media/sf_oracle_sw/grid/rpm
 [root@riyadh1 rpm]# CVUQDISK_GRP=oinstall; export CVUQDISK_GRP
 [root@riyadh1 rpm]# rpm -Uvh cvuqdisk*
 Preparing... ########################################### [100%]
 Using default group oinstall to install package
 1:cvuqdisk ########################################### [100%]
 [root@riyadh1 rpm]#

 

Clone the existing node:

Now we will clone the existing node. i.e we will create node2 ( riyadh2 from riyadh1)

Shutdown the VM.

Go to MACHINE – > CLONE

 

54

55

56

 

Now for riyadh2 (node 2) , we have to change the MAC address . Because MAC address is unique for each machine.

Just change the MAC address, by changing the last character of the address.

if it is 080027B7A349 . Then change it to 080027B7A34A. Do the same for both network adapters.

57

58

 

 

Now start both the nodes.

In node2 : change the hostname to riyadh2 in the network file.

 

[root@riyadh1 sysconfig]# vi /etc/sysconfig/network

change riyadh1 to riyadh2

In VM2(riyadh2) go to SYSTEM – PREFERNCE – NETWORK CONNECTION. You will see something like this.

 

59

 

Remove Auto eth2 and Auto eth3.

60

 

Now edit the mac adress to (080027B7A34A) which we set in the previous setup

 

61

 

 

Set the new ips for node 2:

62

 

Do the same change ( mac address change and ip address change ) for other adapter ( eth1) also.

Lets change the ethernet port names.

The existing file will look like this.

cat /etc/udev/rules.d/70-persistent-net.rules
 # This file was automatically generated by the /lib/udev/write_net_rules
 # program, run by the persistent-net-generator.rules rules file.
 #
 # You can modify it, as long as you keep each rule on a single
 # line, and change only the value of the NAME= key.
ATTR{address}=="08:00:27:b7:a3:49", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100e (e1000)

# PCI device 0x8086:0x100e (e1000)
 SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:b7:a3:4a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
# PCI device 0x8086:0x100e (e1000)
 SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:94:dd:8c", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

Remove the entries for eth0 and eth1  and rename eth2 to eth0 and eth3 to eth1.

Now the file should look like below.

[root@riyadh1 ~]# cat /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:b7:a3:4a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:94:dd:8c", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

Reboot the VM2 to reflect the changes.

To confirm whether changes are done or not , we can run ifconfig.

[root@riyadh1 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:B7:A3:4A 
 inet addr:192.168.100.26 Bcast:192.168.100.255 Mask:255.255.255.0
 inet6 addr: fe80::a00:27ff:feb7:a34a/64 Scope:Link
 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
 RX packets:9 errors:0 dropped:0 overruns:0 frame:0
 TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000 
 RX bytes:650 (650.0 b) TX bytes:900 (900.0 b)
eth1 Link encap:Ethernet HWaddr 08:00:27:94:DD:8C 
 inet addr:192.168.10.22 Bcast:192.168.10.255 Mask:255.255.255.0
 inet6 addr: fe80::a00:27ff:fe94:dd8c/64 Scope:Link
 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
 RX packets:10 errors:0 dropped:0 overruns:0 frame:0
 TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:1000 
 RX bytes:700 (700.0 b) TX bytes:746 (746.0 b)
lo Link encap:Local Loopback 
 inet addr:127.0.0.1 Mask:255.0.0.0
 inet6 addr: ::1/128 Scope:Host
 UP LOOPBACK RUNNING MTU:16436 Metric:1
 RX packets:16 errors:0 dropped:0 overruns:0 frame:0
 TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:0 
 RX bytes:960 (960.0 b) TX bytes:960 (960.0 b)

 

[root@riyadh1 sysconfig]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=riyadh2.localdomain

 

Add public, private,vip,scan host entries in /etc/hosts file of both node1 and node2.

So hosts file should look like below.

 

cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# Private
192.168.10.21 riyadh1-priv.localdomain riyadh1-priv
192.168.10.22 riyadh2-priv.localdomain riyadh2-priv
# Public
192.168.100.25 riyadh1.localdomain riyadh1
192.168.100.26 riyadh2.localdomain riyadh2
# Virtual
192.168.100.35 riyadh1-vip.localdomain riyadh-vip
192.168.100.36 riyadh2-vip.localdomain riyadh-vip
# SCAN
192.168.100.45 riyadh-scan.localdomain riyadh-scan
192.168.100.46 riyadh-scan.localdomain riyadh-scan
192.168.100.47 riyadh-scan.localdomain riyadh-scan

 

Now we will create a shared disk , which will be shared between both node1 and node2.

63

64

65

66

67

68

69

 

Now go to FILE – > VIRTUAL MEDIA MANAGER

70

71

 

Now add the shared disk to node 2 also.

 

72 73

74

 

Now we will partition the shared storage to create asmdisks.

Start both the nodes and login to any of the  nodes as root user.

[root@riyadh1 ~]# ls /dev/sd*
 /dev/sda /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda4 /dev/sda5 /dev/sdb
[root@riyadh1 ~]#
[root@riyadh1 ~]# fdisk /dev/sdb
 Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x4026c989.>
Changes will remain in memory only, until you decide to write them.
 After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): N
 Command action
 e extended
 p primary partition (1-4)
 p
 Partition number (1-4): 1
 First cylinder (1-7754, default 1): 1
 Last cylinder, +cylinders or +size{K,M,G} (1-7754, default 7754): 
 Using default value 7754
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@riyadh1 ~]# ls /dev/sd*
 /dev/sda /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda4 /dev/sda5 /dev/sdb /dev/sdb1
 [root@riyadh1 ~]# oracleasm createdisk DISK1 /dev/sdb1
 Writing disk header: done
 Instantiating disk: done
[root@riyadh1 ~]# oracleasm scandisks
 Reloading disk partitions: done
 Cleaning any stale ASM disks...
 Scanning system for ASM disks...
[root@riyadh1 ~]# oracleasm listdisks
 DISK1
 [root@riyadh1 ~]#
 Now check in the other node:
 [root@riyadh2 ~]# oracleasm scandisks
 Reloading disk partitions: done
 Cleaning any stale ASM disks...
 Scanning system for ASM disks...
 Instantiating disk "DISK1"
 [root@riyadh2 ~]# oracleasm listdisks
 DISK1
 [root@riyadh2 ~]#

 

Now we can see the asm disk is visible to both the nodes.

Lets configure the ssh connectivity between both the nodes.

 click on this link for ssh connectivity establishment.

 

Lets proceed with GRID INSTALLATION:

Login to node 1 as oracle user

[oracle@riyadh1 ~]$ cd /media/sf_oracle_sw/grid/

[oracle@riyadh1 grid]$ ./runInstaller

Starting Oracle Universal Installer…

Checking Temp space: must be greater than 415 MB.   Actual 24517 MB    Passed

Checking swap space: must be greater than 150 MB.   Actual 8999 MB    Passed

Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-03-18_02-42-21PM. Please wait …

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

 

With this now our grid installation is done.   Lets proceed with oracle binary installation.

Oracle rdbms installation:

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

 

Now create a database.

Database creation

cd $ORACLE_HOME/bin

./dbca

122

123

124

125

127

128

129

130

131

132

133

134

135

136

137

 

Now your oracle database with 2 node RAC is ready.