# Introduction
## Architecture

To better understand the RAC Installation, this picture illustrates the architecture that is implemented when following the book.

## IP Addresses

In order to install a fully functional RAC, the following IP addresses are required:
* 2 public IPs, one for each node, for the primary OS network interface
* 2 public IPs, one for each node, for the Virtual IP
* 3 public IPs, one for each SCAN listener
* 2 private IPs, one for each node, for the cluster private interconnect
In the book, the public addresses belong to the network 192.168.78.0/24, and the private addresses belong to the network 172.16.100.0/24.

## Technical choices

The book aims to provide instructions as simple as possible to get a basic RAC installation on your laptop. There are many, many advanced topologies and topics that are not covered here. If you are curious about technical possibilities, just ask a volunteer, he/she will be glad to explain you something more.

# Hardware Requirements

This handbook will walk you through the process of creating a two-node Oracle RAC cluster on your own laptop or desktop computer.

## Hardware Minimum Requirements

Most modern laptop and desktop computers should be powerful enough to run a two-node virtual RAC cluster. In a nutshell, these are the recommended minimums:
* Modern CPU (most of laptops produced after 2011 should be ok)
* 8Gb memory
* 40Gb of free disk space
** 9Gb Software Staging
** 29Gb - 2VMs + 2 ASM disks
* Windows 64bit (XP, Vista or 7) (Linux & Mac have been tested as well and differences to the Windows instructions are included in the book)

# Software Components

Before starting you need to know what software will be installed. If attending an event, would be a good idea to download the software in advance to your laptop in order to avoid the download during the labs. The copyrighted software is not distributable so the volunteers will not be able to give you all the required software components. But organizers may have set up a proxy server to speed up downloads or provide at least the free software.

## Windows 7 64 bit

This book covers Windows 7 64 bit as host even if all operating systems that can run VirtualBox 64-bit can be used. 64 bits are mandatory since Oracle 12c for Linux 32-bit is not available.

## VirtualBox

This book uses VirtualBox as many Oracle specialists consider it as a mature and free virtualization solution, fully compatible with Oracle Software: https://www.virtualbox.org/. The VirtualBox version 4.3.26 and older versions from 4.2.12 up to 4.2.18 have been tested successfully with OEL6 and Oracle 12c. The latest successfully tested VirtualBox version is 5.0.8
A few virtualbox versions (4.3.14 to 22 if I remember well ) had serious problems on Windows. EL 6.4 to 6.7 have been tried without problems.

## Putty

One of the preferred SSH clients for Windows. You can download it here:

## Vnc Viewer

The servers will be installed without X server, so you'll need VNC to get the graphics:

## Oracle Software
### Oracle Enterprise Linux 6

Can be downloaded from http://edelivery.oracle.com/linux/.
* Login to: http://edelivery.oracle.com/linux with your Oracle Account
* On the Media Pack Search page, select:
* Click on: Oracle Linux Release 6 Update 4 Media Pack for x86_64 (64 bit)
* Click on the download button at the first line:
* Once the download of the file V37084-01.iso is finished, rename it to Oracle_Linux_6_64.iso to distinguish it easily from other Oracle files.

### Oracle Grid Infrastructure and Database 12c (12.1.0.1)

Can be downloaded from http://edelivery.oracle.com/.
* Login to: http://edelivery.oracle.com/ with your Oracle Account
* On the Media Pack Search page, select:
* Click on: Oracle Database 12c Release 1 (12.1.0.1.0) Media Pack for Linux x86-64
* Click on the download button for the following four packs:
* The following files are downloaded:

# Prepare Host
## VirtualBox Setup

* Run Oracle VM VirtualBox Setup.
* On the welcome page, click Next:
* Leave the default component selection, click Next:
* Click Next:
* Unless you have pending downloads or batches over the network, click Yes:
* Click Install:
* The installation is completed. Click Finish to open VirtualBox:

## VirtualBox Network Configuration

* Run VirtualBox Manager.
* From the main screen, choose File > Preferences > Network.
* Double click on VirtualBox Host-Only Ethernet Adapter. VirtualBox will suggest a default address of 192.168.56.1. Please update the settings as shown and click Ok twice.

# Install Linux
## Create VirtualBox VM

* On your computer, create a new folder racattack12c on a location of your choice that will contain all the virtual disks.
* In VirtualBox, from the main screen, click the New icon in the upper left hand corner.
* Type in collabn1 for the Name of the VM. Choose Linux for the Type and Oracle (64 bit) for the Version and click Next.
* Type 3072 in the Size field and click Next. If you only have 8GB total ram, decrease this to 2510, otherwise your laptop may slow down
* Leave Create a virtual hard drive now selected and click Create.
* Leave VDI (VirtualBox Disk Image) selected and click Next.
* Leave Dynamically allocated selected and click Next.
* Type in the full path or choose through the browse icon the Location for the disk file to be created.

## VirtualBox VM Settings

* From the main screen, select the virtual machine collabn1 and click the Settings icon in the upper left hand corner.
* Open the USB sub-menu. Uncheck the Enable USB Controller check box.
* Open the Storage sub-menu. Delete the Empty disk under the IDE Controller.
* Click on Remove to confirm.
* Click on the Add CD/DVD Device.
* Click on the Choose disk.
* Locate and open the Oracle_Linux_6_64.iso file.
* Open the Network sub-menu. Under the Adapter 1 tab, change the Attached to: dropdown to Host-only Adapter.
* Choose the Adapter 2 tab. Check the box for Enable Network Adapter. Change the Attached to: dropdown to Internal Network and type the name rac-priv in the Name field.
* Choose the Adapter 3 tab. Check the box for Enable Network Adapter. Change the Attached to: dropdown to NAT.
* Select the Shared Folders tab. Click Add Shared Folder.
* Click on Ok to save the modifications.
* Review the summary of the new virtual machine.

## OS Installation

* Click on Start to boot the virtual machine. If asked to select a start-up disk, choose Oracle_Linux_6_64.iso and click Start again.
* The Oracle Linux install screen will automatically come up. Hit enter to begin the install.
* Skip the CD testing by pressing the right arrow key and press enter.
* From this point on you can use the mouse to navigate. To unlock the mouse and keyboard from the VM, hit the right Ctrl key. Click Next.
* Leave English (English) selected and click Next.
* Leave U.S. English selected and click Next (unless you have another preferred keyboard layout).
* Leave Basic Storage Devices selected and click Next.
* Click Yes, discard any data for the warning box stating The storage device below may contain data.
* In the hostname field, type collabn1.racattack. Click Configure Network in the bottom left corner. Highlight System eth0 and click the Edit... button. Click the Connect automatically checkbox. Click the IPv4 Settings tab. Click the Method: dropdown and select Manual. Click Add and type 192.168.78.51 for the address. Leave Netmask at 24. In the DNS servers: box, type 192.168.78.51, 192.168.78.52. In the Search domains: box, type racattack. Click the Apply button.
* Highlight System eth1 and click the Edit... button. Click the Connect automatically checkbox. Click the IPv4 Settings tab. Click the Method: dropdown and select Manual. Click Add and type 172.16.100.51. Change Netmask to 24. Click the Apply button.
* Highlight System eth2 and click the Edit... button. Click the Connect automatically checkbox. Click the IPv4 Settings tab. Click the Method: dropdown and select Automatic (DHCP) addresses only. Click the Apply button. Click Close to close the network configuration menu and click Next.
* Leave the timezone settings as they are and click Next.
* Enter the Root Password as racattack and click Next.
* Click Use Anyway when warned about the weak password.
* Click Use All Space for the installation type and click Next.
* Click Write changes to disk when warned about Writing storage configuration to disk.
* Leave Basic Server as the default installation type. Click Next.
* The operating system will take a while to install.
* When the installation is complete, click Reboot.
* The reboot no longer shows messages, just a progress bar.
** You can see the progress by hitting F8 while the server is booting.
** The system should boot to a command line login prompt.

## Linux Post Installation

* To connect to the new created virtual machine, create a connection in Putty for the new VM called collabn1 with the IP Address of 192.168.78.51.
* Open the collabn1 connection by clicking Open. Click Yes on the Security Alert dialog box.
* Enter root at the login as: prompt and racattack at the password: prompt.
* Turn off and disable the firewall IPTables.
* Disable SELinux. Open the config file and change the SELINUX variable from enforcing to disabled.
* Verify that all the network interfaces are up.
* Add the DVD as repository.
* Install the database preinstall package oracle-rdbms-server-11gR2-preinstall.
* Install additional RPMs that will be used to install and administer the servers.
* Uninstall NTP.
* Unmount the DVD before continuing with the next steps.

## Install VirtualBox Addons

* Make the VirtualBox guest additions available to the OS by clicking Devices->Install Guest Additions.
* Mount the virtual CD-Rom created by VirtualBox.
* Install the VirtualBox Guest Additions. The error related to the step Installing the Window System drivers is ok to ignore, it will not appear on newest VBox versions.
* Dismount the cdrom.

## Configure Bind DNS

If BIND DNS not installed the run #yum install -y bind (after step 9 in Linux Post Installation before unmount /media/cdrom)
* Enable BIND DNS to start at boot time.
* Change named directory permissions.
* Backup the BIND configuration file.
* Change /etc/named.conf permissions.
* Run the following command or edit the /etc/named.conf file to change the named configuration manually.
* Create the zone file for the racattack domain on collabn1 by running the following command:
* Create the reverse zone file on collabn1.
* Generate the rndc.key file.
* Restart the named service.
* Check that the parameter PEERDNS is set to no in /etc/sysconfig/network-scripts/ifcfg-eth2 to prevent the resolv.conf from being overwritten by the dhcp client:
* If it was set to yes previously, restart the network and verify that the file /etc/resolv.conf contains now the correct nameservers:
* /etc/resolv.conf should contain:
* Check that the master DNS on collabn1 is working.

## Prepare Linux for Oracle

* Modify the pam.d login file to use limits.
* Change the password for the oracle user to racattack.
* Create and change the ownership of the directories for Clusterware and the Database installations.
* Modify the oracle user so that it belongs to the vboxsf group.
if BIND DNS not installed the run #yum install -y bind (after step 9 in Linux Post Installation before unmount /media/cdrom)

# Create Cluster
## Create VirtualBox Shared Storage

* Shutdown the server:
* In the VirtualBox Manager, select the machine collabn1, click Settings -> Storage.
* Leave VDI (VirtualBox Disk Image) selected and click Next.
* For the shared storage, select Fixed size and click Next.
* Change the location of the file to the folder racattack12 previously created.
* Now the disk is physically created with a size of 5Gb, so it can take more time to complete.
* Repeat the steps to create three more disks:
* Finally, four virtual disks should have been created for asm.
* Make all the asm devices sharable: from VirtualBox Manager, click File -> Virtual Media Manager.
* For each asm devices: right-click -> Modify:
* Select Shareable and click OK. Do it for the four asm devices.
* Start the machine collabn1.

## Configure Storage Persistent Naming

* Once the new disks are visible by the server, add a primary partition on each of them with fdisk.
* Repeat the same step for sdc, sdd and sde.
* Configure the option -g for the scsi_id command to expect an UUID from the shared devices.
* Test to see if scsi_id - returns data
* Prepare the file /etc/udev/rules.d/99-oracle-asmdevices.rules by running the following script:
* Once completed, the file should look like the following (except for the scsi UUID).
* Reload the udev rules and restart udev:
* The new disks are ready for use:

## Clone VirtualBox VM

* Shutdown the VM.
* Clone the disk collabn1.vdi: from VirtualBox Manager, click File -> Virtual Media Manager.
* Right-click on the disk collabn1.vdi and click Copy...
* Leave the file collabn1.vdi, click Next.
* Leave VDI as file type. Click Next.
* Leave Dynamically allocated. Click Next.
* Type in the full path or choose through the browse icon the Location for the disk file to be created.
* Click Close to exit from the Virtual Media Manager.

## Create Second VirtualBox VM

* In VirtualBox, click New icon in the upper left corner to create the new VM.
* Type in collabn2 for the Name of the VM. Choose Linux for the Type and Oracle (64 bit) for the Version and click Next.
* Type 3072 in the Size field and click Next. If you only have 8GB total ram, decrease this to 2510, otherwise your laptop may slow down
* Select Use an existing virtual hard drive file and use the folder icon to locate the file collabn2.vdi previously created.
* There are now two virtual machines; collabn2 being a clone of collabn1.
* Open the USB sub-menu. Uncheck the Enable USB Controller check box.
* Open the Network sub-menu. Under the Adapter 1 tab, change the Attached to: dropdown to Host-only Adapter.
* Choose the Adapter 2 tab. Check the box for Enable Network Adapter. Change the Attached to: dropdown to Internal Network and type the name rac-priv in the Name field.
* Choose the Adapter 3 tab. Check the box for Enable Network Adapter. Change the Attached to: dropdown to NAT.
* Select the Shared Folders tab. Click Add Shared Folder.
* Open the Storage sub-menu.
* Click on Choose existing disk:
* Select the disk asm1.vdi and click Open.
* Repeat the operation to add all remaining asm disks.
* Click on Ok to save the modifications.
* Review the summary of the new virtual machine.
* Start the collabn2 VM.

## Configure Second Linux VM

* The network won't be available yet because we reinitialized the network adapters so the following changes will need to be done in the VM. Log in as root/racattack. Type the command system-config-network. Device configuration is already highlighted. Press Enter.
* eth0 (eth0) - Ethernet is already highlighted. Press Enter.
* Go down to the Static IP line. Change the IP to 192.168.78.52. Go down to Ok and press Enter.
* Select eth1 (eth1) - Ethernet and press Enter. Go down to the Static IP line. Change the IP to 172.16.100.52. Go down to Ok and press Enter.
* Tab down to Save and press Enter.
* Arrow down to DNS configuration and press Enter.
* In the Hostname field, change to collabn2.racattack. Tab down to Ok and press Enter.
* Tab down to Save&Quit and press Enter.
* Check that the parameter PEERDNS is set to no in /etc/sysconfig/network-scripts/ifcfg-eth2 to prevent the resolv.conf from being overwritten by the dhcp client:
* Remove the udev network rules file. It will be regenerated on the next reboot with the new MAC addresses.
* Remove the HWADDR and UUID lines in the network adapter configuration files.
* Reboot the collabn2 VM by typing reboot.
* Verify that all the network interfaces are up.
* Verify that all the ASM devices are visible.

## Complete DNS Setup

* Open a session on collabn2.
* Stop the DNS service.
* Remove the actual DNS files.
* Modify the file /etc/named.conf by using the following command:
* Start the named service.
* Check that both the master on collabn1 and slave on collabn2 DNS servers are working.

## VNC Server Setup

* Configure VNC Server with the oracle account (passwords won't be displayed):
* Open a vncviewer on your laptop and fill the ip address of collabn1 followed by :1.
* Enter the password racattack when prompted:
* The graphical interface is ready for the Grid Infrastructure Installation.

# Install Grid Infrastructure
## Prepare for GI Install

* Verify that the VirtualBox Shared folder containing the installation media is mounted correctly and that Oracle has access to it:
* You can decide to unzip it from your laptop (using Windows native functionalities, WinZip, 7-Zip or other tools or directly from the server.
* Once the package decompression is completed, you'll end up with two directories, grid and database containing the installation files.
* Install the cvuqdisk package as root:
* Do the same on node collabn2:

## Install Grid Infrastructure

* From the VNC remote session, run the installation of Grid Infrastructure as oracle:
* The Installation starts displaying a Splash Screen:
* Leave Skip software updates and click Next:
* Leave Install and Configure Oracle Grid Infrastructure for a Cluster and click Next:
* Leave Configure a Standard Cluster and click Next:
* Leave Typical Installation and click Next:
* In the SCAN Name box, enter collabn-cluster-scan.racattack
* Click SSH connectivity...
* Enter racattack as the password of oracle user and click Setup.
* The setup of SSH equivalency is initiated.
* Click OK when it's completed.
* Click on Identify Network Interfaces...
* Some prerequisite validation is done at this step. It can require some minutes to complete.
* Since the SCAN Name chosen is too long (more than 15 chars.) Oracle proposes a different name as the Cluster Name. Click Yes.
* Leave the default Oracle Base and Software Location.
* racattack is a weak password and Oracle raise an alert. Click Yes to continue:
* Leave DATA as Disk Group Name.
* Check two disks that will be immediately allocated to the new disk group.
* Leave the default Inventory Directory. Click Next.
* Check Automatically run configuration script and then Use "root" user credentials.
* It takes some time to complete the prerequisite checks.
* If everything is correct, you will notice two checks that have failed:
* Click Yes to confirm that you want to skip some prerequisites.
* The summary page appears. Optionally, click Save Response File and choose a location to have the response file saved for this installation session.
* Review the summary and click Install to start the installation.
* The installation starts. It may take more than an hour, depending on your laptop hardware.
* After a while, the installation asks a confirmation before running some scripts as root. Click Yes to continue.
* The installation continues, again, it may take longtime to complete. Once it's finished, click on Close to exit.

## Check Cluster Status After GI Install

* Once your Grid Infrastructure installation is finished, you can get the status of the cluster components:
* Optional step: in order to increase the resistance of your nodes to the huge latency of a Virtualbox environment, you can increase the timeout of CRS before it causes a fencing (restart) of the node.

## ASM Configuration

* From a VNC session, run the ASM Configuration Assistant:
* The asmca opens on the Disk Groups tab, showing the DATA diskgroup created by the installer. Click on Create.
* Enter FRA as the disk group name.
* The diskgroup is being created.
* The diskgroup is created.
* Click on the Volumes tab, then on Create.
* The volume is created.
* Select the ASM Cluster File Systems tab.
* Select Cluster File System.
* To complete the filesystem creation, run this script as root.
* Finally, the filesystem is mounted on both nodes.

# Install Database Software

* In a VNC session, run the installer as oracle user.
* The splash screen appears.
* Uncheck I wish to receive security updates via My Oracle Support and click Next.
* Click Yes to confirm that you do not want to be informed about security updates.
* Select Skip software updates and click Next.
* Select Install database software only and click Next.
* Select Oracle Real Application Clusters database installation and click Next.
* Verify that all nodes are selected and click Next.
* Click Next to accept the default language selection.
* Select Enterprise Edition and click Next.
* If you have previously created the ACFS 1Gb filesystem, you will need to specify another location now.
* Leave dba for all groups except for the OSOPER group (leave it empty) and click Next.
* The installer checks all prerequisites.
* Review the installation summary, optionally save a response file, and click Install.
* The installation can take half an hour on common laptop configurations.
* right before completing, the installer ask to run a script on both nodes as root. Do not click OK.
* Execute the script on both nodes as root.
* Click OK on the previous window, then click Close to exit the Installer.

# Create Database

* Run the Database Configuration Assistant:
* The splash screen appears.
* Select Create Database and click Next.
* Select Create a database with default configuration.
* A warning is shown because the password is weak. Click Yes to continue.
* The prerequisite checks may fail due to space requirements. It's safe to ignore by checking Ignore all.
* Review the summary page and click Finish.
* The database creation is finished. Click Exit, then Close.