Content
- Introduction
- System Requirements
- Download Software
- Virtual Machine Setup
- Guest Operating System Installation
- Check Internet Access
- Oracle Clusterware Installation Prerequisites. Part 1
- Install Guest Additions
- Oracle Clusterware Installation Prerequisites. Part 2
- Network Setup
- Downloaded Oracle Installation Files
- Clone the Virtual Machine
- Create Shared Disks
- Install the Grid Infrastructure
- Install the Database Software
- Install the Database
- Check the Status of the RAC
- Making Images of the RAC Database
- Restoring RAC from Saved Files
Introduction
![image](http://www.lab128.com/pict1.jpg)
This is my second article on Oracle RAC installed in VirtualBox. The first one was about RAC version 11g, which drew very positive feedback from readers. Over last year, I became very active user of VirtualBox, this is quite stable piece of software and I moved many aging physical computers in my household into virtual machines. A year ago I bought 16 GB of RAM for my laptop (paying about $100) and never regretted about this purchase. Probably it is even more affordable now. Given this trend of galloping RAM size, the entry-level laptop computers with 16 GB are not far away from now. In this article I made adjustments for Oracle 12c and latest VirtualBox versions. Some steps were straightened or dropped making installation of 12c slightly easier than 11g. Your feedback is welcome, it helps to make the whole procedure simpler and faster.
If you want to get through all steps of the Oracle RAC installation and your laptop or desktop computer has 8 GB or more of RAM (16 GB is recommended), then this is entirely feasible using Oracle VirtualBox as demonstrated in this article. You can get a running RAC system which can host a small test database. The created system is not, and should not be considered, a production-ready system. It's simply to allow you to get used to installing and using RAC and test various administration procedures. The article also explains how to save the images and restore RAC from the images in a matter of minutes. Even if you break your test system, it will be easy to restore.
This article uses the 64-bit versions of Oracle Linux, version 6.4, and Oracle 12c Release 1, version 12.1.0.1.0. Using VirtualBox you can run multiple Virtual Machines (VMs) on a single server, allowing you to run both RAC nodes on a single machine. In addition, it allows you to set up shared virtual disks. The finished system includes two guest operating systems, two sets of Oracle Grid Infrastructure (Clusterware + ASM) and two Database instances all on a single server.
System Requirements
- 8 GB of RAM;
- 44 GB of free space on the hard disk + staging area for Oracle Linux and RAC downloads, about 9 GB;
- This procedure was tested on 64-bit Windows 7. The successful installation was also reported on MacBook Pro 2011, 8GB RAM, with OS X 10.8.5 (Mountain Lion) and VirtualBox 4.2.18 - thanks to Rudresh Rana who shared this information. It should be no problem using VirtualBox on other Host OSes. Please let me know if you had success or problems in other OSes;
Download Software
Download the following software.
- Oracle Linux; Once in the Oracle Cloud service, select "Oracle Linux" and "x86 64-bit". Then click on release (6.4.0.0.0) and download Oracle Linux Release 6 Update 4 for x86_64 (64 Bit) - V37084-01;
- VirtualBox (the latest available version 4.2.18 was used);
- Oracle Database 12c Release 1 (12.1.0.1.0) (use Linux x86-64, then "See All" link).
- Oracle Database 12c Release 1 Grid Infrastructure (12.1.0.1.0) for Linux x86-64 (use Linux x86-64, then "See All" link).
Virtual Machine Setup
In this exercise, we are using VirtualBox installed on 64-bit Windows 7.
We must define two virtual RAC nodes. We can save time by defining one VM, then cloning it when it is installed.
Start VirtualBox and click the "New" button on the toolbar. Enter the name "rac1", OS "Linux" and Version "Oracle (64 bit)", and then click the "Next" button:
Set Base Memory to 3072 MB, then click the "Next" button:
Accept the default option to create a new virtual hard disk by clicking the "Create" button:
Accept the default VDI type and click the "Next" button on the Create Virtual Hard Drive screen:
Accept the default "Dynamically allocated" option by clicking the "Next" button:
Accept the default file name and set size to "20G", then click the "Create" button:
The "rac1" VM will appear on the left hand pane. Click on the "Network" link on the right side:
Make sure "Adapter 1" is enabled, attached to "Internal Network" or "Host-only Adapter". This inetrface will be used for public network, for example, for connection to the RAC datbase from other applications. More about networking will be explained later. On the screenshot below "Internal Network" is selected and name "pubnet" was given to this network:
Then click on the "Adapter 2" tab. Make sure "Adapter 2" is enabled and attach to "Internal Network". Name this network "privnet":
Then finally click on the "Adapter 3", enable it, and attach to "Bridged Adapter" or "NAT". This adapter will be used for internet. Then press "OK" button:
Optionally, you can disable the audio card using "Audio" link. This will probably save some amount of space and avoid potential problems related to audio settings. Also if your system has 4 CPU cores or more, it will make sense to allocate 2 CPUs to the Virtual Machine. You can do that in "System" settings.
The virtual machine is now configured so we can start the guest operating system installation.
Guest Operating System Installation
Please note that during installation VirtualBox will be keeping the mouse pointer inside VM area. To exit, press Right Control key on the keyboard.
We will use Oracle Linux 6.4 ISO image downloaded earlier. Place the .iso file into the virtual DVD. Select "Storage" link on the right hand pane of the VirtualBox Manager screen to open "Storage" screen. Then select DVD drive in the "Storage Tree" section:
In "Attributes" section click on the DVD disk icon and choose DVD .iso file. Note that name of the file shows in the Storage Tree. Then press 'OK":
Start the virtual machine by clicking the "Start" button on the toolbar. The resulting console window will contain the Oracle Linux boot screen. Proceed with the "Install or upgrade an existing system":
Do not perform the media test. Choose "Skip" button:
Continue through the Oracle Linux installation as you would for a normal server. On next three screens select Language, Keyboard, and Basic Storage Devices type. Confirm to discard any data.
Note. For this sandbox setup we used domain name "localdomain". You can change it, but keep in mind to make same change throughout this exercise.
Set "Hostname" to rac1.localdomain and press "Configure Network":
In the Network Connections screen select "System eth0" interface, which will be used for public network, and press "Edit":
Make sure that "Connect automatically" is checked. Select "IPv4 Settings" tab; change Method to "Manual"; Press "Add" and fill Address: 192.168.56.71; Netmask: 255.255.255.0; Gateway: 0.0.0.0. Press "Apply" then done:
In the Network Connections screen select "System eth1" interface, this will be used for private network, then press "Edit". Then check the box "Connect automatically". Select "IPv4 Settings" tab; change Method to "Manual". Press "Add" and fill Address: 192.168.10.1; Netmask: 255.255.255.0; Gateway: 0.0.0.0. When done, press "Apply":
Finally select "System eth2" interface, this will be used for Internet, then press "Edit". Check the box "Connect automatically". Select "IPv4 Settings" tab make sure the Method is set to "Automatic (DHCP)". Press "Apply" button:
Close Network Connections screen and proceed to next setup screen. Select time zone; Type in Root Password: oracle;
Select "Use All Space" type of installation and check "Review and modify partitioning layout":
Edit size of lv_swap device to 1700 MB; then edit size of lv_root to 18276 MB. Press "Next":
Confirm through warnings and create partitions. Keep defaults in Boot loader screen.
In the software type installation screen select "Database Server" and check "Customize now" button. Press Next:
In the Customization screen select "Databases" and uncheck all items; select "Desktops" and check "Desktop" and "Graphical Administration Tools"; then press Next and finish installation. Reboot.
When it comes back, there will be more setup screens obvious to handle. Don't create 'oracle' account, this will be done later. You can skip Kdump settings. Congratulations! The Linux has been installed.
Tip. We will need to to use Terminal program (Main Menu | Applications | System Tools | Terminal) very often. You can save time by adding Terminal icon to the Panel or Desktop. Right click on Terminal menu item and select either "Add this launcher to panel" or "Add this launcher to desktop".
Check Internet Access
We will need Internet access because additional packages will be installed online. Open terminal (Main menu | Applications | System Tools | Terminal) and try to ping any Internet site, for example:
ping yahoo.com
If ping doesn't work, troubleshoot the problem using 'ifconfig' command and making changes in Network Connections (Linux desktop Main menu | System | Preferences | Network Connections). If you made changes in Network Connections, restart interface by rebooting VM or running these two commands:
# ifdown eth2 # ifup eth2
Then check the ping again.
Oracle Clusterware Installation Prerequisites. Part 1
All actions in this section must be performed by the root user.
Install 'oracle-rdbms-server-12cR1-preinstall' package. This package performs prerequisites including kernel parameter change and creation of Linux oracle account:
# yum install oracle-rdbms-server-12cR1-preinstall
Note. Probably you will not be able to paste and copy this command. So you will have to type it manually. We are going to fix that shortly by installing Guest Additions. For now just type those commands.
Another Note. While using 'yum' sometimes I have seen this error: "Existing lock /var/run/yum.pid: another copy is running as pid 523. Another app is currently holding the yum lock; waiting for it to exit...". When this happened, I was interrupting this wait with 'Ctrl-C' and then killing reported process, in this example 523: 'kill 523'. After that, next run of yum was always OK.
There are two preferred ways to make shared drives visible to ASM: Udev and ASMLib. You have to choose between them. There are pros and cons of one or another way, you can find discussions on this topic in Internet. If you don't care and only interested in having RAC installed, choose ASMLib because it is easier and uses less of OS resources, which is more suitable for the laptop setup. Next two actions should be done if ASMLib is selected. Skip them if you decide on Udev way.
1. Install ASMLib:
# yum install oracleasm # yum install oracleasm-support
2. Configure ASMLib running this command and answering questions:
# 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 []: oinstall 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 #
Tip. We will need to edit configuration files. If you are not familiar with "vi" editor or prefer GUI editor, install "gedit":
yum install gedit
For example, to edit "/etc/hosts" file, use this command: "gedit /etc/hosts".
Install Guest Additions
Guest Additions are optional, but highly recommended. Guest Additions allow better integration of mouse support and clipboard bidirectional copying. Another important feature is support of shared folders making files in Host OS visible to Guest. The remaining of this document assumes that Guest Additions are installed.
In order to install Guest Additions, reboot just created VM: Menu | System | Shut Down. Login as root. Then in the window menu select Devices | Install Guest Additions. Go through the download until you see DVD Autorun screen:
Press "OK", then "Run" to start installation.
Note. The installation can fail complaining on missing kernel-uek-devel package providing a 'yum' command to install this package. Run this command - that's why we need Internet access. Also install another package: 'yum install gcc'. Then reinstall Guest Additions by double-clicking on VBOXADDITIONS DVD icon on the desktop, and clicking "Open Autorun Prompt" button.
Shutdown VM. In VirtualBox Manager window select "General", "Advanced" tab, and make sure that "Shared Clipboard" is set to "Bidirectional". Restart the machine. Now you should be much happier about VirtualBox!
Oracle Clusterware Installation Prerequisites. Part 2
Create the directory in which the Oracle software will be installed.
mkdir -p /u01/app/12.1.0/grid_1 mkdir -p /u01/app/oracle chown -R oracle:oinstall /u01 chown oracle:oinstall /u01/app/oracle chmod -R 775 /u01/
Add oracle account to vboxsf groups. The vboxsf group was created by VirtualBox Guest Additions and will allow oracle user access folders in the Host OS:
# usermod -G dba,vboxsf oracle
Reset oracle user password to oracle:
# 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. #
Disable secure linux by editing the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows.
SELINUX=disabled
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. In this case we will deconfigure NTP.
# service ntpd stop Shutting down ntpd: [FAILED] # chkconfig ntpd off # mv /etc/ntp.conf /etc/ntp.conf.orig # rm /var/run/ntpd.pid
Cleanup YUM repositories:
# yum clean all
Check file system usage, about 2.8 GB is used:
# df -k Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/vg_rac1-lv_root 18420484 2768724 14716032 16% / tmpfs 1544584 100 1544484 1% /dev/shm /dev/sda1 495844 78322 391922 17% /boot #
Network Setup
All actions in this section must be performed by the root user.
Below is TCP layout of addresses used in public and private networks. If you need to use another addresses, make corresponding adjustments and remember to stay consistent with those adjustments throughout the rest of the article. Please note that the subnet 192.168.56.0 is a default configuration used by the VirtualBox as Host-only network connecting the host OS and virtual machines. The VirtualBox is also running DHCP server on this subnet reserving address range 100-254. So it is safe to use addresses below 100 for static addresses. You can verify these settings in: Main menu | File | Preferences | Network, then check the properties of the Host-only network. We are using this subnet for the RAC public network. Even if you don't need to connect from the Host OS to the RAC, and you used VB "Internal Network" for Adapter1, you still can use proposed layout without making changes.
Edit "/etc/hosts" file by appending the following information:
# Private 192.168.10.1 rac1-priv.localdomain rac1-priv 192.168.10.2 rac2-priv.localdomain rac2-priv # Public 192.168.56.71 rac1.localdomain rac1 192.168.56.72 rac2.localdomain rac2 # Virtual 192.168.56.81 rac1-vip.localdomain rac1-vip 192.168.56.82 rac2-vip.localdomain rac2-vip # SCAN 192.168.56.91 rac-scan.localdomain rac-scan 192.168.56.92 rac-scan.localdomain rac-scan 192.168.56.93 rac-scan.localdomain 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. If you are using DNS, then comment out lines with SCAN addresses.
We already set IP addresses of all adapters during Linux unstallation. If you followed the instructions, there is no need to change anything. But if you need to change something, you can do so with the Network Connections tool: Linux desktop Main menu | System | Preferences | Network Connections.
Now we need to disable the firewall: Linux Main menu | System | Administration | Firewall. Click on "Disable" icon, then on "Apply".
Downloaded Oracle Installation Files
There are two options to handle Oracle downloads:
- Download or transfer files into VM and uncompress them in VM;
- Download and uncompress in the Host OS, then make folders accessible to VM filesystem;
Obviously second option is much better because it doesn't use virtual disk of Guest VM and will result in smaller final image. Also installation files can be easily reused in another installation exercise. In this section we are going to setup VirtualBox Shared Folders.
It is assumed that you already downloaded oracle installation files and uncompressed them into the "grid" and "database" folders. In our example these folders are in "C:\TEMP\oracle_sw" folder.
C:\TEMP\oracle_sw>dir -l total 0 drwx------+ 1 sromanenko Domain Users 0 Aug 5 18:10 database drwx------+ 1 sromanenko Domain Users 0 Aug 5 03:08 grid
Shutdown VM. In VirtualBox Manager click on "Shared Folders" link in the right-hand pane. Add shared folder by pressing "plus" icon. Then select path to the location of oracle software, and check both boxes "Read-only" and "Auto-mount":
Note You can use any name in "Folder Name". If you have oracle installation files at different location, you can overwrite that name to "oracle_sw". This will make easier to follow steps below.
Press "OK" to save this setting. Now Shared Folders should look like this:
Restart VM and login as oracle user. Change directory to "/media/sf_oracle_sw" - this is where VirtualBox maps Host OS shared folder. Note that VirtualBox added prefix "sf_" to the name of the folder. List 'ls' content of the folder:
$ cd /media/sf_oracle_sw $ ls database grid $
Note. If you used folder name other than "oracle_sw" while creating shared folder, then you will see "/media/sf_<folder name>" directory, please keep this in mind and make corresponding adjustments.
There is one package 'cvuqdisk' that should be installed before the installation. Install it from the Oracle grid/rpm directory as root user:
$ su root Password: # cd /media/sf_oracle_sw/grid/rpm # CVUQDISK_GRP=oinstall; export CVUQDISK_GRP # rpm -Uvh cvuqdisk*
Clone the Virtual Machine
Shutdown the VM.
In the VirtualBox Manager window start clone wizard: Main menu | Machine | Clone. Type "rac2" for the name of new machine. Make sure that "Reinitialize the MAC address of all network cards" is not checked. Then press "Next":
Keep default "Full Clone" option selected and press "Clone":
Start cloned VM rac2 and login as root user. Then change hostname by editing file "/etc/sysconfig/network", HOSTNAME parameter:
HOSTNAME=rac2.localdomain
Start "Network Connections" tool (Main menu | System | Preferences | Network Connections). Edit eth0 and eth1 interfaces and set in IPv4 addresses 192.168.56.72 and 192.168.10.2 correspondingly.
Reboot system.
Now we need to change MAC address for all three interfaces. At the moment we have two VMs with the same set of MAC addresses. We can run one machine or another, but not both of them at the same time because MAC address must be unique. No changes will be made to rac1, we will pick up three new unused addresses and set them for eth0, eth1, and eth2 in rac2. The easiest way to do that is to change just last two characters of the address. We are going to change them to '00'. If the last two characters are already '00', then change to something else, '01', for example. Just make sure that these addresses don't collide with the MAC addresses of rac1. In running rac2 node, open "Network Connections" and edit MAC address in the "Wired" tab. The screenshot below shows where to set MAC address. Don't forget to change MAC addresses for all three interfaces. Please note that your setup will have a different set of MAC addresses because they are random-generated by VirtualBox.
Write down the new MAC addresses for all three interfaces. Save new settings pressing "Apply" button, then shutdown the machine. After shutdown, return to the VirtualBox Manager, select rac2 VM and edit "Network" settings. Make same changes to the MAC addresses. Don't forget to change MAC addresses for all three adapters.
Start both machines and check that they can ping each other using both public and private network. For example, on rac1:
$ ping rac2 $ ping rac2-priv
If you have problems, use 'ifconfig' command to check the configuration, then correct the problem using "Network Connections" tool.
Create Shared Disks
Shut down both virtual machines. We need to create a new virtual disk, change its attribute to Shareable and add to both VMs. In the current version of VirtualBox, the only way to create a new disk in the GUI is through the "Storage" page in the virtual machine's settings. Select either rac1 or rac2 VM, then click on "Storage" link. Select "SATA Controller" and click on "Add Hard Disk" icon. If not sure, which icon to use, same action is available through the popup menu, right-click on the "SATA Controller" and select "Add Hard Disk".
Press "Create new disk":
Accept the default VDI type and click the "Next" button on the Virtual Disk Creation Wizard welcome screen:
Select "Fixed size" option and press the "Next" button:
Change the name and location of this disk. You can keep this file in the default location - the folder of a selected VM. Although, because this disk is shared, it will be better to put it in the parent directory. So, instead of "...\VirtualBox VMs\rac1" directory, place it in "...\VirtualBox VMs". Set the size to "4 GB". If you will need more space, you can choose the bigger size. And, regardless of what you decide now, it will be possible to add more shared disks to the ASM group after everything is installed.
Create the new disk and this disk will be already attached to VM.
Select this new disk. You will see in the disk Information that the type of this disk is "Normal". We need to change this to "Shareable". There was no option in the previous dialog windows to create new disk as "Shareable". Press OK and close storage settings. In the VirtualBox Manager open Virtual Media Manager: (Main menu | File | Virtual Media Manager). Select this new disk in the Virtual Media Manager:
Click on "Modify" icon and select "Shareable":
Attach this existing disk to the other VM using "Storage" page. Don't forget to select correct controller before attaching the disk and use "Choose existing disk" option.
In the end the "Storage" section of both VMs should be looking like this:
Start either of the machines and log in as root. The current disks can be seen by issuing the following commands.
# ls /dev/sd* /dev/sda /dev/sda1 /dev/sda2 /dev/sdb #
Use the "fdisk" command to partition the new disk "sdb".
# 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 0xd724aa83. 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-391, default 1): Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-391, default 391): Using default value 391 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. #
The sequence of answers is "n", "p", "1", "Return", "Return" and "w".
Once the new disk is partitioned, the result can be seen by repeating the previous "ls" command.
# ls /dev/sd* /dev/sda /dev/sda1 /dev/sda2 /dev/sdb /dev/sdb1 #
If you decided earlier on ASMLib way of exposing shared disks to ASM then do "Create ASMLib Disk" section, otherwise do "Udev Configuration" below.
Create ASMLib Disk
Mark the new shared disk in the ASMLib as follows.
# oracleasm createdisk DISK1 /dev/sdb1 Writing disk header: done Instantiating disk: done #
Run the "scandisks" command to refresh the ASMLib disk configuration.
# oracleasm scandisks Reloading disk partitions: done Cleaning any stale ASM disks... Scanning system for ASM disks... #
We can see the disk is now visible to ASM using the "listdisks" command.
# oracleasm listdisks DISK1 #
Start another VM and log in as root. Check that the shared disk is visible to ASM using the "listdisks" command.
# oracleasm listdisks DISK1 #
The virtual machines and shared disks are now configured for the grid infrastructure! Optionally, you can save this state using Simplified Way of Saving/Restoring Images. Please skip the next section "Udev Configuration".
Udev Configuration
This configuration needs to be done on both nodes, you can do it step by step in parallel on both nodes.
Open "/etc/scsi_id.config" file (for example, "gedit /etc/scsi_id.config", if the file doen't exist, it will be created) and add this line:
options=-g
Execute "scsi_id" file command for the shared disk.
# /sbin/scsi_id -g -u -d /dev/sdb 1ATA_VBOX_HARDDISK_VBb6f0fac5-f473897a
You will have different SCSI ID output. This id will be used in udev rules file. Edit "/etc/udev/rules.d/99-oracle-asmdevices.rules" file and add following entry as one line. Make sure you use SCSI ID from the previous command.
KERNEL=="sd?1", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -d /dev/$parent", RESULT=="1ATA_VBOX_HARDDISK_VBb6f0fac5-f473897a", NAME="asm-disk1", OWNER="oracle", GROUP="dba", MODE="0660"
Restart VM, login as oracle and check that shared disk can be exposed to ASM:
$ ls -al /dev/asm* brw-rw---- 1 oracle dba 8, 17 Oct 6 13:31 /dev/asm-disk1
The virtual machines and shared disks are now configured for the grid infrastructure! Optionally, you can save this state using Simplified Way of Saving/Restoring Images.
Install the Grid Infrastructure
Make sure the "rac1" and "rac2" virtual machines are started, then login to "rac1" as oracle user (better to avoid using "su -" command, I had problems) and start the Oracle installer.
$ cd /media/sf_oracle_sw/grid $ ./runInstaller
Select "Skip software updates" option, press "Next":
Select the "Install and Configure Grid Infrastructure for a Cluster" option, then press the "Next" button.
Select the "Configue a Standard cluster" option, then click the "Next" button.
Select the "Advanced Installation" option, then click the "Next" button.
Select Language and go to the next screen. On the "Grid Plug and Play information" screen, change Cluster Name to "rac-cluster" and SCAN Name to "rac-scan.localdomain", uncheck "Configure GNS" box, then press the "Next" button.
On the "Cluster Node Configuration" screen, click the "Add" button.
Enter the details of the second node in the cluster, then click the "OK" button.
Click the "SSH Connectivity..." button and enter the password for the "oracle" user. Click the "Setup" button to configure SSH connectivity, and the "Test" button to test it once it is complete. Then press "Next".
On the "Specify Network Interface Usage" screen check the Public and Private networks are specified correctly. Press the "Next" button.
On the "Grid Infrastructure Management Repository Option" screen check "No" and press the "Next" button. Confirm this decision on the next screen.
On the "Storage Option Information" screen keep Oracle ASM option selected and press "Next".
On the "Create ASM Disk Group" screen click on "Change Discovery Path" button:
If us earlier used ASMLib configuration, then enter "/dev/oracleasm/disks" (shown in the screenshot below). If you used Udev configuration, then enter "/dev/asm*". Press "OK":
Keep "Disk Group Name" unchanged. Select "External" redundancy option. Check "/dev/oracleasm/disks/DISK1" or "/dev/asm-disk1" in the "Add Disks" section. When done, press "Next".
On the "Specify ASM Password" screen select "Use same passwords for these accounts" option and type in "oracle" password, then press "Next". Ignore warnings about password weakness.
Keep defaults on the "Failure Isolation Support" and press "Next".
Keep defaults on the "Privileged Operating System Groups" and press "Next". Ignore warning on the next screen.
Keep suggested Oracle base unchanged, and adjust Software location on the "Specify Installation Location" and press "Next".
Keep suggested path unchanged on the "Create Inventory" and press "Next".
In the "Root script execution configuration" select "Automatically run configuration scripts" and check "Use root option", then type password oracle. Press "Next".
The results of prerequisite checks are shown on the next screen. You should see three warnings and one failure. The failure was caused by inability to lookup SCAN in DNS and that should be expected. Check "Ignore All" box and press "Next".
Press "Install" on the Summary screen.
Wait while installation takes place... When asked to confirm root scripts execution, answer Yes. The "root script" step was the longest one, so be patient!
We expect the verification phase to fail with errors related to low Host RAM, Swap File sizes, group mismatch for DISK1, and "udev information". These errors can be ignored. You can check errors opening log file. For example, for the log file shown below "gedit /u01/app/oraInventory/logs/installActions2013-09-30_10-25-44PM.log", then search for "Error".
Here is the example of offending lines from the log file for rac1 node:
INFO: INFO: Error Message:PRVF-7530 : Sufficient physical memory is not available on node "rac1" [Required physical memory = 4GB (4194304.0KB)] INFO: INFO: Cause: Amount of physical memory (RAM) found does not meet minimum memory requirements. INFO: INFO: Action: Add physical memory (RAM) to the node specified. ... INFO: INFO: Error Message:PRVF-7573 : Sufficient swap size is not available on node "rac1" [Required = 2.9462GB (3089292.0KB) ; Found = 1.6602GB (1740796.0KB)] INFO: INFO: Cause: The swap size found does not meet the minimum requirement. INFO: INFO: Action: Increase swap size to at least meet the minimum swap space requirement. ... INFO: INFO: ERROR: [Result.addErrorDescription:618] PRVF-9992 : Group of device "/dev/oracleasm/disks/DISK1" did not match the expected group. [Expected = "dba"; Found = "oinstall"] on nodes: [rac1, rac2] ... oracle INFO: INFO: ERROR: [Result.addErrorDescription:607] PRVF-9802 : Attempt to get udev information from node "rac1" failed INFO: No UDEV rule found for device(s) specified INFO:
Provided these are the only errors, it is safe to ignore them and continue by clicking the "Next" button. Close the Configuration Assistant on the next screen.
Check the status of running clusterware. On rac1 as root user:
# . oraenv ORACLE_SID = [oracle] ? +ASM1 The Oracle base has been set to /u01/app/oracle # crsctl status resource -t -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATA.dg ONLINE ONLINE rac1 STABLE ONLINE ONLINE rac2 STABLE ora.LISTENER.lsnr ONLINE ONLINE rac1 STABLE ONLINE ONLINE rac2 STABLE ora.asm ONLINE ONLINE rac1 Started,STABLE ONLINE ONLINE rac2 Started,STABLE ora.net1.network ONLINE ONLINE rac1 STABLE ONLINE ONLINE rac2 STABLE ora.ons ONLINE ONLINE rac1 STABLE ONLINE ONLINE rac2 STABLE -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE rac2 STABLE ora.LISTENER_SCAN2.lsnr 1 ONLINE ONLINE rac1 STABLE ora.LISTENER_SCAN3.lsnr 1 ONLINE ONLINE rac1 STABLE ora.cvu 1 ONLINE ONLINE rac1 STABLE ora.oc4j 1 OFFLINE OFFLINE STABLE ora.rac1.vip 1 ONLINE ONLINE rac1 STABLE ora.rac2.vip 1 ONLINE ONLINE rac2 STABLE ora.scan1.vip 1 ONLINE ONLINE rac2 STABLE ora.scan2.vip 1 ONLINE ONLINE rac1 STABLE ora.scan3.vip 1 ONLINE ONLINE rac1 STABLE -------------------------------------------------------------------------------- #
You should see various clusterware components running on both nodes. If there were serious problems during installation, the components of clusterware wouldn't start. Also you can check clusterware alert file "gedit /u01/app/12.1.0/grid_1/log/rac1/alertrac1.log" (on rac1 node, make adjustments for rac2).
The grid infrastructure installation is now complete! Optionally, you can save this state using Simplified Way of Saving/Restoring Images.
Check filesystem usage, about 8.6 GB are used:
$ df -k Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/vg_rac1-lv_root 18420484 8691564 8793192 50% / tmpfs 1544584 649740 894844 43% /dev/shm /dev/sda1 495844 78322 391922 17% /boot$
Install the Database Software
Make sure the "rac1" and "rac2" virtual machines are started, then login to "rac1" or switch the user to oracle and start the Oracle installer.
$ cd /media/sf_oracle_sw/database $ ./runInstaller
Uncheck the "I wish to receive security updates..." checkbox and press the "Next" button:
Check "Skip software updates" checkbox and press the "Next" button:
Check "Install database software only" option and press "Next" button:
Select "Oracle Real Application Cluster database installation" and then press "Next" button.
Make sure both nodes are selected. Press on "SSH Connectivity" enter "oracle" password and then press "Setup" button. After the SSH connectivity setup is finished, press "Test" button to test it. Then press Next button.
Select Language on next screen and press the "Next" button.
Accept "Enterprise Edition" option and press the "Next" button:
Accept default installation locations and press the "Next" button:
Accept default groups in "Privileged Operation System groups" and press the "Next" button:
Wait for the prerequisite check to complete. If there are any problems, either fix them, or check the "Ignore All" checkbox. On the screenshot below 3 warnings are shown which are safe to ignore. Click the "Next" button.
If you are happy with the summary information, click the "Install" button.
Wait while the installation takes place.
Execute root scripts when prompted on both nodes.
# /u01/app/oracle/product/12.1.0/dbhome_1/root.sh Performing root user operation for Oracle 12c The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/app/oracle/product/12.1.0/dbhome_1 Enter the full pathname of the local bin directory: [/usr/local/bin]: The contents of "dbhome" have not changed. No need to overwrite. The contents of "oraenv" have not changed. No need to overwrite. The contents of "coraenv" have not changed. No need to overwrite. Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root script. Now product-specific root actions will be performed. #
Press "Close" button and the Oracle DB software is now installed! Optionally, you can save this state using Simplified Way of Saving/Restoring Images.
Install the Database
Start dbca - DB Configuration Assistant:
$ cd /u01/app/oracle/product/12.1.0/dbhome_1/bin $ ./dbca
Accept "Create Database" option and press the "Next" button:
Check "Create a database with default configuration"; type in "Global Dtabase Name" the desired name; we have selected AL32UTF8 character set, make your choice as needed; also supply a password for SYS. We are going to create a reqular (pre-12c type) database, the "Create As Container Database is unchecked. Press Next button:
Wait for the prerequisite check to complete. The only reported problem was all familar "Swap Size". Check "Ignore All" checkbox and click the "Next" button.
Press "Finish" button in the Summary screen:
Click the "Close" button to exit the installer.
The RAC database creation is now complete!
Check the Status of the RAC
There are several ways to check the status of the RAC. The srvctl
utility shows the current configuration and status of the RAC database.
$ . oraenv ORACLE_SID = [oracle] ? racdb The Oracle base has been set to /u01/app/oracle $ srvctl config database -d racdb Database unique name: racdb Database name: racdb Oracle home: /u01/app/oracle/product/12.1.0/dbhome_1 Oracle user: oracle Spfile: +DATA/racdb/spfileracdb.ora Password file: +DATA/racdb/orapwracdb Domain: localdomain Start options: open Stop options: immediate Database role: PRIMARY Management policy: AUTOMATIC Server pools: racdb Database instances: racdb1,racdb2 Disk Groups: DATA Mount point paths: Services: Type: RAC Start concurrency: Stop concurrency: Database is administrator managed $ srvctl status database -d racdb Instance racdb1 is running on node rac1 Instance racdb2 is running on node rac2 $
The V$ACTIVE_INSTANCES
view can also display the current status of the instances.
$ export ORACLE_SID=racdb1 [oracle@rac1 Desktop]$ sqlplus / as sysdba SELECT inst_name FROM v$active_instances; INST_NAME -------------------------------------------------------------------------------- rac1.localdomain:racdb1 rac2.localdomain:racdb2 exit $
Making Images of the RAC Database
At any point earlier we could save the image of created virtual machine and then restore it at will. Here we are going to save images of the newly created Oracle RAC system which we can restore in the same system or even hand over to another location and restore in a matter of few minutes!
If all you need is saving and restoring images in the same VirtualBox setup, you can use Simplified Way of Saving/Restoring Images.
The export of VM is a straightforward process and saving RAC images would be an easy task if not dealing with the shared disk. In my view the simplest way to handle that is by detaching shared disk from both nodes and taking care of these three parts (two self-contained VMs and one Shared disk) separately. In the end there will be three files: two files for VMs and a file representing the shared disk. These three files can be further zipped by your favorite archiver into one file which can be used for storage or transfer. After export is done, the shared disk can be easily attached back to the nodes. Same is true for the import of VMs back into VirtualBox along with the copy of shared disk - the shared disk is attached to the imported VMs as an extra step. Let's perform all these actions.
Clean Shutdown of RAC
But first, we need to shutdown servers in nice and clean manner because we want save them in a robust state. Shutdown the database. As oracle user execute on any node:
$ . oraenv ORACLE_SID = [oracle] ? racdb The Oracle base has been set to /u01/app/oracle $ srvctl stop database -d racdb $
Shutdown the clusterware on the first node. As root user execute:
# . oraenv ORACLE_SID = [racdb1] ? +ASM1 The Oracle base remains unchanged with value /u01/app/oracle # crsctl stop crs ... CRS-4133: Oracle High Availability Services has been stopped. #
Shutdown the clusterware on the second node. As root user execute:
# . oraenv ORACLE_SID = [racdb1] ? +ASM2 The Oracle base remains unchanged with value /u01/app/oracle # crsctl stop crs ... CRS-4133: Oracle High Availability Services has been stopped. #
Shutdown both virtual machines. Wait until all VM windows are closed.
Detach Shared Disk and Make a Copy Of It
In the VirtualBox Manager open Virtual Media Manager: Main menu | File | Virtual Media Manager. Then select the disk used by the RAC (rac_shared_disk1.vdi). Note that this disk shows as attached to rac1 and rac2 VMs:
Click on "Release" icon and then confirm in the pop-up window. Note that this disk now shows as "Not attached". Click on "Copy" to start Disk Copying Wizard.
Accept Virtual disk to copy and press "Next".
Accept Virtual disk file type as VDI and press "Next".
Select "Fixed size" and press "Next".
On the next screen you can set location and name of the new file. When done, press "Next".
On the Summary screen review details and press "Copy" to complete copying. Close the Media Manager when copying is done.
Note. Do not try to copy .vdi file because the copy will retain same disk UID and VirtualBox will refuse to use it because there is already such disk. When copying trough the Virtual Media Manager, the new UID is assigned automatically.
Export VMs
In the VirtualBox Manager select VM, then call Appliance Export Wizard: Main menu | File | Export Appliance. Exporting is generally as simple as saving a file. Export both VMs.
Now you should have 3 files that can be further zipped into a single file with the size about 12 GB.
Re-attach Shared Disk to the Original RAC Setup
Fix our current working RAC setup by re-attaching shared disk to rac1 and rac2 VM using "Storage" page. Don't forget to select correct controller before attaching the disk:
Press "Add Hard Disk" icon and use "Choose Existing Disk" to attach rac_shared_disk1.vdi
. Once Shared disk is attached to both VMs, the RAC is ready to run.
Restoring RAC from Saved Files
In this section we will import RAC from the saved files creating a second RAC system. Don't run both RAC at the same time because they will have same network attributes.
Open Appliance Import Wizard: Main menu | File | Import Appliance. Choose the file and press "Next":
On the Appliance Import Settings different attributes of new VM can be changed. We are going to accept settings unchanged. It is interesting to note, that disks are going to be imported in VMDK format different from the original VDI format.
Wait until the VM is imported:
Import both VMs and copy Shared Disk rac_shared_disk1_copy.vdi
file into the parent directory (Virtual VMs). This disk could be attached to both machines, but unfortunately current version (4.1.18) of VirtualBox doesn't preserve type of the disk then making a copy. Attach this disk to the either of imported VM, then select it and review disk information:
In the VirtualBox 4.1.18, the copied disk has "Normal" type. If you have a newer version and the type is "Shareable" then this bug has been fixed, and you can proceed to another VM. If not, de-attach the disk, then go to the Virtual Media Manager and change the disk type to "Shareable" as has been described above, then return to the Virtual machines and attached the Shared disk.
Start new VMs. The clusterware should start automatically. You will need to bring up the database. Login as the oracle user and execute:
$ . oraenv ORACLE_SID = [oracle] ? racdb The Oracle base has been set to /u01/app/oracle $ srvctl start database -d racdb $
The RAC should be well and running!
Simplified Way of Saving/Restoring Images
This is not a supported way to save/restore images in VirtualBox, but it is very simple and worked well. The restore is limited to the VirtualBox setup where images were saved.
Stop both VMs. Find the location where VB stores images: Main menu | File | Preferences | General, "Default Machine Folder" box. For example: "C:\Users\sromanenko\VirtualBox VMs". Go to this folder and locate "rac1", "rac2" directories and "rac_shared_disk1.vdi" file. Make a .zip or .rar file containing these three items. If you don't have compressing tools and there is enough disk space, you can copy these three items to another location. The images are saved!
In order to restore these images:
- Make sure VMs are stopped;
- Go to the "VirtualBox VMs" folder and delete "rac1", "rac2" directories, and "rac_shared_disk1.vdi" file;
- Restore these three items from the .zip file or copy from the location where these items were saved;
The restored VMs are ready to run.
That's it! Please send your feedback to: