Thursday, July 23, 2009

Installing Oracle on RHEL 5 (32 and 64 bit) - Part 1

With the then-hyped Oracle Enterprise Linux rollout, and Ellison's evident disdain for Microsoft, you'd have thought that Oracle would go out of their way to make it straightforward to install and use Oracle database on Linux. It's not so, unfortunately. Not that it can't--or shouldn't--be done, mind you: it works great; you just need some persistence. This is part one of a three-part series on Oracle on Linux. This post looks at getting the OS ready for Oracle. Part 2 looks at installing the database software, and Part 3 talks about some of the things that can be done to make running and maintaining Oracle easier on Linux. Oracle has a document here that does a pretty good job of outlining the steps necessary to install Oracle on linux. I quibble with some of their instructions, particularly their directions to use the package rpms from the Oracle install CD. If they're going to go to the trouble of providing the requisite rpms, it seems like they'd also install them during the installation process, if they're needed. Instead, it seems like a *much* better option to install them from your repository (CENTOS or RedHat are most pertinent to this guide). They also have you using rpm, which is fine, but it won't find dependencies for you like yum will. In any case, I do recommend that document for additional information. It's my hope that this series will help navigate the installation process and make it easier. I've broken this into several posts so as to keep the length of each one a little smaller, anyway. In this post, we'll get the OS prepped and ready for the
Oracle software installation.

Prerequisites

It's important to make sure you've got all the necessary software installed on your server before beginning the installation of Oracle. They've done a better job with 11g of testing for the existence of prerequisite software, so you get some better error messages when you are lacking a particular package. Here are the prerequisites that you don't have with a default RHEL install:
  • compat-libstdc++-33
  • elfutils-libelf-devel
  • gcc
  • gcc-c++
  • glibc-devel
  • libaio-devel
  • libstdc++-devel
  • sysstat
  • unixODBC
  • unixODBC-devel
So:
yum install compat-libstdc++-33 elfutils-libelf-devel gcc gcc-c++ glibc-devel libaio-devel libstdc++-devel sysstat unixODBC unixODBC-devel
Now, another thing that has gotten better with 11g is the documentation about prerequisites for 64-bit systems. It turns out that you've got to have both the 64-bit and 32-bit versions of some packages in order for things to go smoothly. The 64-bit prereqs that aren't installed as a part of a standard RHEL install are:
  • compat-libstdc++-33
  • compat-libstdc++-33 (32 bit)
  • elfutils-libelf-devel
  • gcc
  • gcc-c++
  • glibc-devel
  • glibc-devel (32 bit)
  • libaio-devel
  • libstdc++-devel
  • sysstat
Which translates to
yum install compat-libstdc++-33 compat-libstdc++-33*.i386 elfutils-libelf-devel gcc gcc-c++ glibc-devel glibc-devel*.i386 libaio-devel libstdc++-devel sysstat

Set up the OS for Oracle

These, again, seem like things that could be done easily by the installer. I know: you don't want to assume folks are installing as root. But why not, instead, require that the installation be done as root and allow the installer to choose these things from the UI? Again, I'm not saying these things are hard, but if you're wanting to increase your install base... Here the instructions for Oracle are quite good, BTW. Create the user account and install directory:
/usr/sbin/groupadd oinstall /usr/sbin/groupadd dba /usr/sbin/useradd -m -g oinstall -G dba oracle mkdir -p /oracle chown -R oracle:oinstall /oracle chmod -R 775 /oracle >passwd oracle
Oracle uses /u01/app/oracle for their default installation location. Seems to me that /oracle makes more sense. In any case, pick what works for you, and use that in the commands above.

Set kernel parameters and user limits

Again, the Oracle docs are quite helpful on this front:
cat >> /etc/sysctl.conf
<<EOF
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=4194304
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=262144
EOF
/sbin/sysctl -p cat >> /etc/security/limits.conf <<EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
 EOF
 cat >> /etc/pam.d/login
 <<EOF
session required /lib/security/pam_limits.so
EOF
Oracle has you set some OS limits on the Oracle user by editing the main system profile file. Their script generates a "unary operator expected" error (at least under some circumstances), so it seems a lot more direct to add that limit to the Oracle user's .bash_profile (assuming you're using bourne). So add the following to /home/oracle/.bash_profile
ulimit -u 16384 -n 65536
umask 022
I find it frustrating not to have tools like SQLPLUS and TNSPING in the path, and I want the Oracle environment variables set automatically, so add the following (modified to match your environment, of course) to .bash_profile, as well. If this is a system that hosts a lot of databases, it might not make sense to set the ORACLE_SID variable; that's up to you. Oracle's recommended method for taking care of this is to use the oraenv script, which is at /oracle/product/11.1.0/db_1/bin/
export ORACLE_BASE=/oracle
export ORACLE_SID=<db_sid>
export ORACLE_HOME=/oracle/product/11.1.0/db_1
export PATH=$PATH:/oracle/product/11.1.0/db_1/bin/
Click here to see the code to use for korn shell and c-shell.
If you're using korn (ksh), add the following to /home/oracle/.profile
ulimit -p 16384 ulimit -n 65536 umask 022
And, finally, if you're using c-shell, add the following to /home/oracle/.login
limit maxproc 16384
limit descriptors 65536
umask 022
That should get things ready for the Oracle installation. In Part 2, we'll get Oracle installed.

1 comment:

  1. Mark Hurd workforce management encompasses time and labor, absence management and is fully integrated with payroll and other core HR functions and financials, to bring accuracy, simplicity, and insight to a once-onerous task. The result is an engaged and connected workforce eager to contribute to organizational success…..

    ReplyDelete

Thanks for leaving a comment!