Oracle Linux 7, Oracle 12c and VirtualBox (gotcha included)

Spoiler alert:  Oracle Linux 7 is not yet certified with any Oracle database, so things may not work as planned.  For me, the Cluster Synchronization Service could not be contacted, so the +ASM instance can’t be started…..

Linux 7 

I was delighted the other day by the ease of installing Oracle Linux 7 into VirtualBox – the actual operating system installation was quick and painless.  Then came the pain.

Having downloaded the four zip files from Oracle.com, I scp’d these files to my shiny new Linux server.  However although each file looked good, the first Grid Infrastructure zipfile had at least two CRC errors, rendering it unusable for an installation.  I got around this by unzipping all the files on my Mac laptop and used scp to throw all the files back onto the server.  This time, the installer ran perfectly.

Portholes and netca

So every Oracle installation I’ve done over the past 20 years or so has used port 1521 as the default port for the listener.  However now on Linux 7, netca fails because it can’t allocate the port it wants to use (1521).  Apparently that’s now defined in /etc/services as belonging to this:

ncube-lm 1521/tcp # nCube License Manager
ncube-lm 1521/udp # nCube License Manager

So, that’s odd.  Seems that as far back as 2008, Oracle indicated that the default port of 1521 would be moving to 2483 or 2484 and told IANA as much (Internet Assigned Numbers Authority).  So the solution, for now, is to comment out the nCube lines in /etc/services and retry netca.

Linux 7 setup

There are a number of ways to get your Linux box ready for an oracle installation; in Oracle Linux 5 and 6, that was handled through yum and the installation of a validated or pre-install package.  This would create users and groups, configure the kernel and download or upgrade packages.  Not a feature available yet on Linux 7 for an Oracle 12c installation.

I created a script for it (created setup.sh in root’s home directory) – and pasted it at the bottom of this post.  At the end, it asks you for the password for the oracle user and then reboots.

Script based upon the Oracle-Base entry.

VirtualBox for Raw Devices

ASM loves raw devices.  Having worked for a flash storage company for a couple of years, I know this to be true because it got to the point I could create these all day and night – and debug storage related issues.

Since I am using VirtualBox for my test machines, I can create many variable sized disks that will be presented as LUNs to the host machine.  The advantage of variable sizing is that I can allocate a 1GB disk and have it consume just a few MB in the beginning.  Of course the host thinks it’s a fixed size LUN of 1GB.

So here’s how I created four virtual disks and added them to the server:

cd /Volumes/HDD*/VirtualBox/OracleLinux7
VBoxManage createhd --filename asm1.vdi --size 1024 --format VDI --variant Standard
VBoxManage createhd --filename asm2.vdi --size 1024 --format VDI --variant Standard
VBoxManage createhd --filename asm3.vdi --size 1024 --format VDI --variant Standard
VBoxManage createhd --filename asm4.vdi --size 1024 --format VDI --variant Standard
VBoxManage storageattach OracleLinux7 --storagectl "SATA" --port 1 --device 0 --type hdd --medium asm1.vdi 
VBoxManage storageattach OracleLinux7 --storagectl "SATA" --port 2 --device 0 --type hdd --medium asm2.vdi 
VBoxManage storageattach OracleLinux7 --storagectl "SATA" --port 3 --device 0 --type hdd --medium asm3.vdi 
VBoxManage storageattach OracleLinux7 --storagectl "SATA" --port 4 --device 0 --type hdd --medium asm4.vdi

So when I look on the server (after a reboot), I see these new devices (the sda* devices are partitions on the root disk).

[root@linux7 system]# ls -l /dev/sd*|sort
brw-rw-rw-. 1 oracle oinstall 8, 16 Aug 20 20:34 /dev/sdb
brw-rw-rw-. 1 oracle oinstall 8, 32 Aug 20 20:34 /dev/sdc
brw-rw-rw-. 1 oracle oinstall 8, 48 Aug 20 20:34 /dev/sdd
brw-rw-rw-. 1 oracle oinstall 8, 64 Aug 20 20:34 /dev/sde
brw-rw-rw-. 1 root disk 8, 0 Aug 20 20:34 /dev/sda
brw-rw-rw-. 1 root disk 8, 1 Aug 20 20:34 /dev/sda1
brw-rw-rw-. 1 root disk 8, 2 Aug 20 20:34 /dev/sda2

I have a couple of lines in /etc/rc.local that is supposed to change the ownership and permissions but apparently rc.local might not be working in Linux 7 the way I expect.. (to be fair, rc.local suggests you create systemd services or use UDEV rules)

chmod 666 /dev/sd*
chown oracle:oinstall /dev/sd[bcde]

UDEV rules would look something like this:

KERNEL=="sdc*[!0-9]|sdd*[!0-9]| sde*[!0-9]|sdb*[!0-9]", OWNER:="oracle", GROUP:="oinstall", MODE:="666"

Until the CSS issue bit me, Oracle’s Grid Infrastructure recognized my disks as candidates.  Excellent….

Next Steps

Next I’ll probably install Oracle 12c without Grid Infrastructure – that should work…..

Code: setup.sh

# script to initiate Oracle Linux 7 for Oracle 12c installation

# set up sysctl.conf
echo "fs.file-max = 6815744" >>/etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128" >>/etc/sysctl.conf
echo "kernel.shmmni = 4096" >>/etc/sysctl.conf
echo "kernel.shmall = 1073741824" >>/etc/sysctl.conf
echo "kernel.shmmax = 4398046511104" >>/etc/sysctl.conf
echo "net.core.rmem_default = 262144" >>/etc/sysctl.conf
echo "net.core.rmem_max = 4194304" >>/etc/sysctl.conf
echo "net.core.wmem_default = 262144" >>/etc/sysctl.conf
echo "net.core.wmem_max = 1048576" >>/etc/sysctl.conf
echo "fs.aio-max-nr = 1048576" >>/etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500" >>/etc/sysctl.conf

# Reload configuration
/sbin/sysctl -p

# Update limits file
echo "oracle soft nofile 1024" >>/etc/security/limits.conf
echo "oracle hard nofile 65536" >>/etc/security/limits.conf
echo "oracle soft nproc 2047" >>/etc/security/limits.conf
echo "oracle hard nproc 16384" >>/etc/security/limits.conf
echo "oracle soft stack 10240" >>/etc/security/limits.conf
echo "oracle hard stack 32768" >>/etc/security/limits.conf

# stop firewall
systemctl stop firewalld
systemctl disable firewalld

# Update linux config
sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config

# Add users and groups
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin
useradd -u 54321 -g oinstall -G dba,oper oracle

# Add/update packages
yum install binutils -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y
yum install zlib-devel -y

# Create installation directories
mkdir -p /u01/app/oracle/product/
chown -R oracle:oinstall /u01
chmod -R 775 /u01

# Update bash profile for oracle
echo "# Oracle Settings" >> /home/oracle/.bash_profile
echo "export TMP=/tmp" >> /home/oracle/.bash_profile
echo "export TMPDIR=$TMP" >> /home/oracle/.bash_profile
echo "export ORACLE_HOSTNAME=ol7.localdomain" >> /home/oracle/.bash_profile
echo "export ORACLE_UNQNAME=cdb1" >> /home/oracle/.bash_profile
echo "export ORACLE_BASE=/u01/app/oracle" >> /home/oracle/.bash_profile
echo "export ORACLE_HOME=$ORACLE_BASE/product/" >> /home/oracle/.bash_profile
echo "export ORACLE_SID=cdb1" >> /home/oracle/.bash_profile
echo "export PATH=/usr/sbin:$PATH" >> /home/oracle/.bash_profile
echo "export PATH=$ORACLE_HOME/bin:$PATH" >> /home/oracle/.bash_profile
echo "export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib" >> /home/oracle/.bash_profile
echo "export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib" >> /home/oracle/.bash_profile
echo "" >> /home/oracle/.bash_profile
echo "set -o vi" >> /home/oracle/.bash_profile
echo "alias sql='sqlplus "/ as sysdba"'" >>/home/oracle/.bash_profile
echo "alias asm='sqlplus "/ as sysasm"'" >>/home/oracle/.bash_profile
echo "alias na='cd $ORACLE_HOME/network/admin'" >>/home/oracle/.bash_profile
echo "alias dbs='cd $ORACLE_HOME/dbs'" >>/home/oracle/.bash_profile
echo "export NLS_DATE_FORMAT='MON-DD-YYYY HH24:MI:SS';" >>/home/oracle/.bash_profile
echo "export EDITOR=vi" >>/home/oracle/.bash_profile
echo "export PS1='[\u@\h \W]\$ '" >>/home/oracle/.bash_profile
echo "" >>/home/oracle/.bash_profile
echo "" >>/home/oracle/.bash_profile

passwd oracle

sync; sync; sync

One thought on “Oracle Linux 7, Oracle 12c and VirtualBox (gotcha included)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s