Home

December 13, 2013

Oracle 11gR2 Installation on Oracle Linux 6

I recently needed to setup an instance of Oracle 11g on my local network. Doing so was fairly straightforward, but at several points during the process, I needed to hunt for various packages to fulfill undocumented prerequisites. An X11 server is also required on the machine you use to connect to the target machine; I had some confusion getting that set up, which this post documents.

Prerequisites

  • A fresh instance of 64-bit Oracle Linux 6. All packages should already have been updated (use yum update).

Installation Preparation

  • Many of the steps in this post follow along roughly with the steps outlined in the official Oracle Database Quick Installation Guide for Linux x86-64, available here.
  • Download both zip files for Oracle Database 11g Release 2 (11.2.0.1.0) for Linux x86_64 from this page.
  • Transfer the zip files for 11g to the Oracle Linux instance, either using scp or wget.
  • Log in to the Oracle Linux instance as a non-root user (I use mquinn in this post).
  • Unzip the two zip files, which will decompress to a database directory alongside the zip files.
  • In section 4.3 of the Oracle documentation, a list of packages required for installation on Oracle Linux 6 is detailed; below is a list of packages I installed to bring my instance in line with this list (install each with sudo yum install <package-name>:
    • compat-libcap1
    • compat-libstdc++-33
    • compat-libstdc++-33.i686
    • gcc
    • gcc-c++
    • ksh
    • libaio
    • libaio-devel
    • sysstat
    • glibc.i686
    • glibc-devel.i686
    • libstdc++.i686
    • libstdc++-devel.i686
    • libaio.i686
    • libaio-devel.i686
  • sudo reboot
  • Create the oinstall and dba groups (oinstall owns filesystem access rights to the Oracle 11g installation), then create the oracle UNIX user:
    • sudo groupadd oinstall
    • sudo groupadd dba
    • sudo useradd -g oinstall -G dba oracle
    • passwd oracle
  • I checked the various kernel settings that Oracle specifies minimum value requirements for; checks include cat /proc/sys/kernel/sem, cat /proc/sys/fx/file-max, cat /proc/sys/fs/file-max, etc. I added the following lines to /etc/sysctl.conf to bring my system in line with these minimums:
    • kernel.sem = 250 32000 100 128
    • fs.file-max = 6815744
    • net.ipv4.ip_local_port_range = 9000 65500
    • net.core.rmem_default = 262144
    • net.core.rmem_max = 4194304
    • net.core.wmem_default = 262144
    • net.core.wmem_max = 1048576
    • fs.aio-max-nr = 1048576
  • If you modified /etc/syctl.conf above, issue sysctl -p /etc/sysctl.conf to update the kernel.
  • Resource limits for the oracle UNIX user must be adjusted; I added the following lines to /etc/security/limits.conf:
    • oracle soft nofile 4096
    • oracle hard nofile 65536
    • oracle soft nproc 2047
    • oracle hard nproc 16384
    • oracle soft stack 10240
    • oracle hard stack 32768
  • Log in as the oracle UNIX user and check the values with ulimit to ensure the changes have taken effect.
  • As root, create the install directory and set permissions:
    • mkdir -p /u01/app
    • chown -R oracle:oinstall /u01/app
    • chmod -R 775 /u01/app
  • Log back in as oracle and configure environment variables for that user in ~/.bash_profile:
    • export ORACLE_BASE=/u01/app/oracle
    • export ORACLE_ISD=XENCSDEV <—- change this to the SID you plan to give your own database.
    • export DISPLAY=192.168.0.4:0.0 <—- change this IP to the IP of the machine you will use to perform the X11 install.
  • Move the unzipped database directory to oracle‘s home directory.
    • Then, as root, change ownership of the directory and its contents: chown -R oracle:oinstall /home/oracle/database

Set up X11 Client and Server

  • The Oracle 11g installer is an X11 application. Unless you have installed a desktop/windowing environment on your Oracle Linux instance, you will need a way to run the X11 application on a separate machine. I am using a laptop running Debian to connect to the Oracle Linux instance; this laptop has X11 installed on it so I’ll use it to display the installation application.
  • On the Oracle Linux instance, install various X11 packages: yum install xorg-x11-xauth xorg-x11-xinit xorg-x11-deprecated-libs libXtst xorg-x11-utils xclock
  • On my laptop, I brought up an xterm and ran xhost + to allow all remote connections (on the local network) to reach my X server.
    • I then ran ps -ef | grep listen and saw that X was running with the -nolisten argument. X needs to be listening for remote connections from Oracle Linux, so I opened /etc/X11/xinit/xserverrc on my laptop and temporarily removed the -nolisten argument provided to X.
    • Restarted X (I use the DWM window manager, so I quit that and ran startx).
    • I verified that X was now listening on port 6000 using netstat -na | grep 6000.
  • From the xterm on the laptop, I SSH’d into the Oracle Linux instance.
    • Note that if you have problems getting the installer started below after SSH'ing in with a basic SSH string/command, you may want to try providing the -X and -Y arguments to ssh to enable X forwarding over SSH. Neither were necessary in my case, but I saw resources using them. The most important thing is that you remember to run xhost +, otherwise the X server will reject the Oracle installation X application.
    • Run xclock on Oracle Linux - if you see a clock appear on your local machine, your local X server is accepting remote applications and you are ready to run the installer.

Run the X11 Installer

  • SSH into Oracle Linux as the oracle UNIX user.
  • sh ~/database/runInstaller - you should see the Oracle 11g graphical installer appear on your local machine in a manner similar to that in the screenshot below:
    • If you encounter a Java exception (“java.lang.UnsatisfiedLinkError…libXext.so.6: cannot open shared object file”), try installing the libXext.686 package. If you get an error like this referencing a shared object other than libXext.so.6, run yum provides <shared-object-file-name> and install any packages listed in the output.

  • Began stepping through the installer choices:
    • Skipped update notifications.
    • Selected Install database software only (my 11g instance will host a PeopleSoft database that I’ll create manually later).
    • Selected Standard Edition
    • Left default Oracle Base at /u01/app/oracle
    • Left default Software Location at /u01/app/oracle/product/11.2.0/dbhome_1
    • Left default Inventory Directory at /u01/app/oraInventory
    • Left default oraInventory Group Name at oinstall.
    • Left default Database Administrator (OSDBA) Group at dba.
    • Left default Database Operator (OSOPER) Group at oinstall.
    • I was notified about missing packages at this point; after installing unixODBC, unixODBC-devel, elfutils-libelf-devel, and oracle-rdbms-server-11gR2-preinstall, only some were resolved. The remaining missing packages were all (but one) for i386, so I gambled and continued anyway (note: installation was successful despite these missing packages).
    • Pressed Finish to start 11g installation.
    • Towards the end of the install, I was notified about scripts that needed to be run as root, so on the Oracle Linux machine:
      • su -
      • sh /u01/app/oraInventory/orainstRoot.sh (this script changed permissions of /u01/app/oraInventory)
      • sh /u01/app/oracle/product/11.2.0/dbhome_1
        • When prompted, I left the default local bin path as /usr/local/bin (this script copied the dbhome, oraenv, and coraenv scripts to /usr/local/bin)
      • Pressed OK on the notification dialog to finsh 11g setup.
    • Installation completed successfully.

Post-Installation

  • Log in as UNIX user oracle.
  • Add the following lines to ~/.bash_profile:
    • PATH=$PATH:/u01/app/oracle/product/11.2.0/dbhome_1/bin
    • ORACLE_UNQNAME=XENCSDEV
    • ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1/bin
  • Log out and log back in or re-source the file using . ~/.bash_profile.
    • You should now be ablee to run emctl, lsnrctl, sqlplus, etc.

Miscellaneous Notes

  • You may want to start one or more databases when Oracle Linux starts. At the very least, you’ll likely want the Oracle Net listener to start at boot.
    • To accomplish this, first make sure you can start and connect to your database by manually bringing up the database in sqlplus and then using lsnrctl to start the Oracle Net listener. If you have problems doing this, you’ll likely need to add or modify $ORACLE_HOME/network/admin/listener.ora and/or $ORACLE_HOME/network/admin/tnsnames.ora - make sure the database’s SID and other attributes are correctly specified in these files.
    • If you can manually start the database and Oracle Net successfully, edit /etc/oratab and add the SID of your database followed by the Y flag according to the format specified in the comments at the top of that file.
    • Create /etc/init.d/oracle - see below for the file contents I used. Credit is due to this article; I made one modification to one of the lines to get it to work in my environment.
    • chmod 755 /etc/init.d/oracle
    • chkconfig --add oracle
    • sudo reboot
    • After reboot, verified that both the database and Oracle Net had started automatically.

/etc/init.d/oracle

This file differs from the source found here in that I am passing $ORA_HOME as an argument to dbstart; if this is not done, Oracle Net will fail to start due to an unspecified value for $ORACLE_HOME_LISTNER, which takes its value from the argument to dbstart at script runtime.

#!/bin/sh
# chkconfig: 345 99 10
# description: Oracle auto start-stop script.
#
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the 
# Oracle database in ORA_HOME.

ORA_HOME=/u01/app/oracle/product/9.2.0
ORA_OWNER=oracle

if [ ! -f $ORA_HOME/bin/dbstart ]
then
    echo "Oracle startup: cannot start"
    exit
fi

case "$1" in
    'start')
        # Start the Oracle databases:
        # The following command assumes that the oracle login 
        # will not prompt the user for any values
        # Remove "&" if you don't want startup as a background process.
        su $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start" &
        su $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME" &
        touch /var/lock/subsys/dbora
        ;;
    'stop')
        # Stop the Oracle databases:
        # The following command assumes that the oracle login 
        # will not prompt the user for any values
        su $ORA_OWNER -c $ORA_HOME/bin/dbshut
        su $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
        rm -f /var/lock/subsys/dbora
        ;; 
esac