2.1 Practice 01 Preparing The Practice Environment PDF
2.1 Practice 01 Preparing The Practice Environment PDF
2.1 Practice 01 Preparing The Practice Environment PDF
Practice 1
Practice Overview
In this practice you will create two virtual appliances. You will then make some configuration changes
on them so that you can use them in the course practices.
Item Value
OS Windows 7,8, or 10 64-bit
Memory 16 GB
Fee HDD space 280 GB
It is recommended not to use the C drive.
Connection Connection to the Internet
Virtualization Oracle VirtualBox version 5
software
At the time of this writing, the product can be downloaded from the following link:
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
• Oracle Database 12c Release 1 Grid Infrastructure (12.1.0.2.0) for Linux x86-64
At the time of this writing, the product can be downloaded from the following link:
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/database12c-
linux-download-2240591.html
2. Download and install the following software products in your hosting PC:
• Oracle VirtualBox version 5 for Windows
• Putty utility
In the following steps, you will create the Oracle VirtualBox appliance srv1.
3. Create a Linux-based VirtualBox appliance with the specifications as shown in the table below. This
is an Oracle VirtualBox appliance which has a fresh installation of Oracle Linux 6.7 installed on it.
- You can download a pre-built copy of the appliance from my website at this link (3.3 GB). I
implemented all the course practices from this pre-built copy. The root password is mentioned
in the readme file.
- Alternatively, follow the procedure to create it from scratch as documented here, or you can
watch the demo in my YouTube channel over here.
Item Value
Hostname srv1
Memory 4 GB
Note: I would recommend to make it 4.2 GB, if possible.
OS Oracle Linux 6.7 64-bit
Storage 100 GB
Note: this is a local storage. You will create the shared storage later in the
practice.
Caution:
If you use the pre-built VirtualBox appliance, make sure to disable the Linux Automatic Update
by performing the following: login as root -> System -> Preferences -> Software updates:
Check for updates: Never, Automatically install: Nothing
Linux Automatic Update makes the appliance so slow and may update a library that conflicts with
downloaded Oracle software release.
4. If you are using a pre-built copy of the virtual machine (like the one available in my web site),
make sure the Guest Additions version is upgraded to the version of the VirtualBox you are using.
The pre-built virtual machine that is available in my site was created using version 5.1.12. If you
are using a later version of Oracle VirtualBox, you should update its VirtualBox Guest Additions.
To Update the VirtualBox Guest Additions in the virtual machine, perform the following steps:
a. In the VirtualBox window, login as root and click on Devices menu | Insert Guest Additions
CD image.
e. Right click on the VirtualBox Additions CD icon and select Eject option.
5. Shutdown srv1 and add network adapters to it by performing the following steps:
Eventually, you will have three network adapters created in srv1. The first one will be used for
public connection, the second one will be used for private connection, and the third one will be
used for the Internet connection (it will get the Internet connection from your hosting PC).
a. In Oracle VirtualBox, go to the network settings of your virtual appliance. Change the value of
the "Attached To" field to "Host-only Adapter".
"Host-only" connection in VirtualBox allows connecting the VM machine to other VM machines
as well as to the hosting PC. This adapter will be used to configure the public connection in the
practice RAC architecture.
b. Click on the "Adapter 2" tab and enable it and set it attached to "Internal Network". Name
this network "privnet".
In VirtualBox, the “Internal Network” configuration allows the VM machine to connect only to
other VM machines. This adapter will be used for private connection in the RAC architecture.
c. Click on the "Adapter 3", enable it, and attach to "Bridged Adapter". This adapter will be
used for connecting to the internet.
b. Disable the audio card using "Audio" link (optional). Then press "OK" button.
7. If you have a firewall software installed into your hosting PC, configure it to allow the traffic to go
to and come from Oracle VirtualBox application.
8. Start srv1, login to it as root and perform the following steps to set the network adapter IP
addresses:
b. Rename the Network Adapters to eth0, eth1, and eth2. To rename an adapter, select it, click
on Edit button, and enter its name in the Connection Name field. Then click on Apply
button.
c. Click on eth0, Edit button, IPv4 Settings tab, change Method to "Manual"
d. Click Add and set the adapter IP address as follows then click on Apply button:
IP Address: 192.168.56.71 (it should always be less than 100)
Netmask: 255.255.255.0
Gateway: 0.0.0.0
Note: You use the 192.168.56.* subnet because this adapter is a "Host-only" adapter. For
an adapter of this type to work, it should take the same subnet as the subnet of “Ethernet
adapter VirtualBox Host-Only Network” in your hosting PC.
To display the IP address assigned to this adapter, in the command prompt of the hosting PC,
issue the ipconfig command. Following is a screenshot of this command output in my PC:
e. Click on eth1, Edit button, make sure the Connect automatically check box is marked, click
on IPv4 Settings tab, change Method to "Manual"
f. Click Add and set the adapter IP address as follows then click on Apply button. This adapter
will be used for the private connection.
IP Address: 192.168.10.1
Netmask: 255.255.255.0
Gateway: 0.0.0.0
g. Click on eth2, Edit button, make sure the Connect automatically check box is marked, click
on IPv4 Settings tab, make sure the method is set to "Automatic (DHCP)". This adapter
will take its IP address from your network and it should get the connection to the Internet
through this connection.
j. Login to srv1 as root, open a terminal window and, and to make sure that the VM machine is
connected to the Internet, ping google.com
ping -c 3 google.com
9. Make sure the firewall is disabled: Linux Main menu | System | Administration | Firewall. Click
on Disable icon, then on Apply button.
# Private
192.168.10.1 srv1-priv.localdomain srv1-priv
192.168.10.2 srv2-priv.localdomain srv2-priv
# Virtual
192.168.56.81 srv1-vip.localdomain srv1-vip
192.168.56.82 srv2-vip.localdomain srv2-vip
11. In the hosting PC, open a command prompt window and ping the srv1 public IP address.
ping 192.168.56.71
12. Configure srv1 in PuTTY. I recommend setting the “keepalives” option to 9 seconds, as shown in
the following screenshot:
14. In the following steps, you will create Oracle software owner users and groups.
a. Create the Oracle Grid Infrastructure home owner user (grid). Oracle database owner is
already there (oracle).
groupadd asmadmin
groupadd asmdba
useradd -u 54323 -g oinstall -G asmadmin,asmdba grid
b. Reset the oracle and grid user passwords. The practice documents assume that the
passwords are set to "oracle".
passwd oracle
passwd grid
15. Make sure that all the required libraries are installed.
/usr/bin/oracle-rdbms-server-12cR1-preinstall-verify
# if the command above reported any missing library, issue the following command:
yum install oracle-rdbms-server-12cR1-preinstall
16. Install and configure the ASM required packages by performing the following steps as root:
a. Install Oracle ASMLib package
yum install oracleasm-support
# the following command will take a few minutes to finish:
yum install kmod-oracleasm
17. Create the directory in which the Oracle software will be installed.
mkdir -p /u01/app/oracle/product
chown -R oracle:oinstall /u01
chmod -R 775 /u01
mkdir -p /u01/app/grid
mkdir -p /u01/app/12.1.0/grid
chown -R grid:oinstall /u01/app/grid
chown -R grid:oinstall /u01/app/12.1.0/grid
chmod -R 775 /u01
In the following steps, you will make the Oracle software installation files available to srv1. Instead of
copying the installation files to the virtual machine, you will decompress the installation files in the
hosting OS, then make the installation folders accessible to srv1 filesystem. This method saves used
disk space in srv1.
19. Decompress the Oracle installation files locally in the hosting PC. The code in this document
assumes that they have been decompressed in the folder D:\staging. The directory structure in
the testing environment looks like the following:
21. In VirtualBox Manager, open the "Settings" of srv1, click on "Shared Folders" link in the right-
hand pane. Add shared folder by pressing "plus" icon. Then select path to the location of the
oracle software installation folder, and mark both boxes "Read-only" and "Auto-mount". You
can change the "Folder Name", if you want to.
23. Login in Putty to srv1 as root and verify that the shared folder is accessible. The shared folder
can be accessed in srv1 in the directory "/media/sf_<folder name>"
[root@srv1 ~]# cd /media
[root@srv1 media]# ls
sf_staging
[root@srv1 media]# cd sf_staging
[root@srv1 sf_staging]# ls
database grid
You need to install the operating system package cvuqdisk. A copy of this package is located in the
<Grid Installation Directory>/rpm. Without this package, Cluster Verification Utility cannot discover
shared disks.
24. Set the environment variable CVUQDISK_GRP to point to the group that will own cvuqdisk,
typically oinstall, then install the rpm.
Instead of creating the second machine (srv2) from scratch, it is easier to build it up by cloning srv1.
In the following steps, you will clone srv1 and make changes on the cloned machine to convert it to
srv2.
27. Make a clone of the virtual machine srv1. Give the new machine the name srv2. When you clone
the machine, make sure to initialize the network cards.
a. Remove srv2 from VirtualBox. When you remove it, select "Remove only" option.
b. Move the folder containing srv2 files to the parent folder of srv1. In my case, the structure
looks like the following after moving the files:
c. Add srv2 back to the VirtualBox: Machine menu | Add | select the vbox file of srv2.
To fix this issue, perform the following steps (make sure srv1 is off):
a. Take note of the new MAC addresses assigned to the network cards. You can obtain them
from the Settings | Network link of srv2.
c. Open a terminal window and edit the udev rule for network devices in the file
/etc/udev/rules.d/70-persistent-net.rules
d. Delete the new rules for eth3-5 added in the bottom of the file and fix the mac address in the
line of your eth0-2 rules. Make sure you are fixing the mac address of the right adapter. The
network cards eth0 to eth2 in the file are not necessarily ordered by their names.
The following is a screenshot of how the file looked like in my case.
e. Edit the file /etc/sysconfig/network-scripts/ifcfg-eth* for the network cards eth0 to eth2
and fix the mac address in each.
The following is how the file looks like in my machine for the network card eth0. The bold
text is the text to fix.
[root@srv2 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
NAME=eth0
BOOTPROTO=none
IPADDR=192.168.56.72
PREFIX=24
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
UUID=565ee263-0ba8-4f29-a2b3-c5c2f17b545d
> HWADDR=08:00:27:75:34:38
GATEWAY=192.168.56.1
LAST_CONNECT=1504849110
f. Reboot srv2.
30. Change the hostname and the IP Addresses of eth0 and eth1 in srv2.
To do it, perform the following:
a. Login as root to the appliance VirtualBox window.
b. Click on System | Preferences | Network Connections
c. Fix the IP addresses of eth0 and eth1 as follows:
eth0:
192.168.56.72
eth1:
192.168.10.2
e. Reboot srv2
f. Start srv1
g. Login to every machine as root and make sure that they can ping each other.
The ping command in Linux by default keeps displaying its reply output. To stop it, you can
press the [Ctl]+[c] key combination. If you are using the command in a terminal window in a
VirtualBox window, the right [Ctl]+[c] shortcut will be recognized by Oracle VirtualBox as a
shortcut to switch the Scale mode. If you want to stop the output of the ping command, use
the Left [Ctl]+[c] shortcut instead.
ping srv1
ping srv1.localdomain
ping srv1-priv
ping srv1-priv.localdomain
ping srv2
ping srv2.localdomain
ping srv2-priv
ping srv2-priv.localdomain
a. Save the configuration of srv2 in Putty. You can use the srv2 public IP address to save its
connection configuration in Putty.
c. Change the font text color of srv2 connection to the light green. This is to make it easy for
you to distinguish between windows connected to srv1 and srv2.
In this section of the practice, you will create three disks which will be shared by srv1 and srv2.
Those disks will later be configured to be used by the ASM.
33. In Oracle VirtualBox, select srv1 VM, then click on "Settings" | "Storage" link | "SATA
Controller" icon | "Add Hard Disk" button.
35. In the "Hard disk file type" window, select "VDI (VirtualBox Disk Image)" then click on Next:
36. In the "Storage on physical hard disk" window, select "Fixed size" then click on Next:
37. In the "File location and size" window, click on the "select folder" icon (marked with step
number 1 on the screenshot below), select the parent folder of the current virtual machine.
Change the disk name to DISK1.vdi, set its size to 10 GB, then click on "Create" button.
38. Repeat the steps above to create an additional two disks named "DISK2" and "DISK3", set the
size of each to 15 GB, and save them in the same parent folder where you created DISK1.
DISK1 10 GB OCR
DISK2 15 GB DATA
DISK3 15 GB FRA
41. Change the type of the shared disks to "Shareable". Click on File menu | Virtual Media
Manager (Ctrl+D) | select DISK1 | click on Modify button | select Shareable option| click on
OK button:
42. Change the type of the other two disks (DISK2 and DISK3) to "Shareable".
44. Attach the shared disks to the other VM using (srv2). In Oracle VirtualBox, select srv2 machine,
click on "Storage" page | click on the SATA controller | click on "Add hardisk" icon | click on
"Choose existing disk" button | select the shared disk file
47. List the disks as seen by srv1. You should see the shareable disks that have been added to the
machine (sdb, sdc, and sdd).
ls /dev/sd*
48. Use the fdisk utility to create partitions in the new disks /dev/sdb , /dev/sdc and /dev/sdd
The sequence of your answers should be "n", "p", "1", "Return", "Return" and "w".
Following is an example:
[root@srv1 ~]# 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 0xe3033fca.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
51. Run the oracleasm command scandisks to refresh the ASMLib disk configuration.
oracleasm scandisks
53. Start srv2 and verify that the same disks are visible to ASM.
oracleasm listdisks
Summary
In this practice you have created two virtual machines and configured three shared storage disks
connected to each of them.
You now have an environment ready to install Oracle Grid Infrastructure software, Oracle
Database software, and create an Oracle RAC database.