»   »   »

Creating a Red Hat Linux and Oracle 10g or 11g Server


These are the steps I follow when I set up a Red Hat Linux and Oracle server for development use. There are a few modifications I'd make for production use, but I'll leave that for you to look up, or I'll create another document detailing this sometime. This details the installation of Oracle10g.

Most of this document was created from experience, and from the online Oracle dociments and Werner Puschitz's great Oracle install documentation.

I have made a note of the additional steps required for the Oracle 11g installation.

Red Hat Install Modifications

During the Linux install, I chose the following partition structures and sizes following Oracle Optimal Flexible Architecture (OFA) recommendations:

swap  2098
/     2016
/opt  1024
/usr  3016
/var  2016
/home 3016
/tmp  1024
/u01  3016 
/u02  fill rest of disk (at least 20GB for a development environment)

Note: u01 is where the core Oracle install will reside (Oracle recommends about 2.5GB for the core install - I've added a bit extra in the above example), u02 will contain the oradata (database files for the instance). If you are going to install more that one instance, it is recommended that you create more partitions like u03, u04 etc.

During the install, I chose to add the "Development Tools", this installed gcc and several other Oracle prerequisites.

Prerequisite File Modifications

Once the Linux install is complete, it's time to check and modify the prerequisites.

If you're not sure if you're installing on a 64 or 32bit system, type: uname -mi

Here is the list of libraries needed for the 32bit install:


For 11g, you'll also need:

unixODBC-2.2.11 (32 bit)
unixODBC-devel-2.2.11 (32 bit)

To determine if you have these libraries (for 32bit 10g) run the following command:

rpm -q binutils compat-db control-center gcc gcc-c++ glibc glibc-common gnome-libs \
         libstdc++ libstdc++-devel make pdksh sysstat xscreensaver libaio

To determine if you have these libraries (for 32bit 11g) run the following command:

rpm -q binutils compat-db control-center gcc gcc-c++ glibc glibc-common gnome-libs \
         libstdc++ libstdc++-devel make pdksh sysstat xscreensaver libaio \
         unixODBC unixODBC-devel

Here is the list of libraries needed for 64bit 10g install:

binutils (x86_64)
compat-db (i386)
compat-db (x86_64)
control-center (x86_64)
gcc (x86_64)
gcc-c++ (x86_64)
glibc (x86_64)
glibc (i686)
glibc-common (x86_64)
gnome-libs (x86_64)
libstdc++ (x86_64)
libstdc++ (i386)
libstdc++-devel (x86_64)
libstdc++-devel (i386)
make (x86_64)
pdksh (x86_64)
sysstat (x86_64)
xscreensaver (x86_64)
libaio (x86_64)
libaio (i386)
libaio-devel (x86_64)

For 11g, you'll also need:

unixODBC-2.2.11 (32 bit)
unixODBC-devel-2.2.11 (32 bit)

To determine if you have these libraries (for 10g 64bit) run the following command:

rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' \
              binutils compat-db control-center gcc gcc-c++ glibc glibc-common gnome-libs \
              libstdc++ libstdc++-devel make pdksh sysstat xscreensaver libaio libaio-devel

for 11g 64bit, run the following command:

rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' \
              binutils compat-db control-center gcc gcc-c++ glibc glibc-common gnome-libs \
              libstdc++ libstdc++-devel make pdksh sysstat xscreensaver libaio libaio-devel \
              compat-libstdc++ elfutils-libelf elfutils-libelf-devel expat glibc-devel \
              glibc-headers libgcc make pdksh sysstat unixODBC unixODBC

In my case, I had to run the following to update my system (for 64 bit 10g) - you may need to run additional commands:

up2date gcc
up2date --arch=i386 glibc-devel
up2date --arch=i386 compat-glibc
up2date --arch=x86_64 compat-libcom_err
up2date libaio-devel
up2date --arch=i386 libstdc++-devel
up2date --arch=x86_64 libstdc++-devel
up2date --arch=x86_64 libaio
up2date --arch=x86_64 compat-libstdc++-33

For 64bit 11g, I had to run:

up2date elfutils-libelf-devel
up2date unixODBC-devel
rpm -Uvh unixODBC-devel-2.2.11-1.RHEL4.1.i386.rpm (after downloading the package from redhat)
up2date --arch=i386 libaio-devel

Run the following, then compare the values you get to the sb value (should be); if any of your values are lower than the recommended values, you'lll have to change them, but if they're higher, DO NOT alter them:

echo shmmax - sb 2147483648:; cat /proc/sys/kernel/shmmax
echo shmmni - sb 4096:; cat /proc/sys/kernel/shmmni
echo shmall - sb 2097152:; cat /proc/sys/kernel/shmall
echo shmmin - sb 1:; ipcs -lm |grep "min seg size"
echo semmsl - sb 250:; cat /proc/sys/kernel/sem | awk '{print $1}'
echo semmns - sb 3200:; cat /proc/sys/kernel/sem | awk '{print $2}'
echo semopm - sb 100:; cat /proc/sys/kernel/sem | awk '{print $3}'
echo semmni - sb 128:; cat /proc/sys/kernel/sem | awk '{print $4}'
echo file-max - sb 65536:; cat /proc/sys/fs/file-max
echo ip_local_port_range - sb 1024 65000:; cat /proc/sys/net/ipv4/ip_local_port_range

Now, if any of your values are less, you'll have to modify the following to change them:

For 10g modify the /etc/sysctl.conf file to set the new kernel parameters:

# added for oracle
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 302522
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144

For 11g modify the /etc/sysctl.conf file to set the new kernel parameters:

# added for oracle
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.aio-max-nr = 1048576
fs.file-max = 68157444
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

For Oracle, the following Kernel parameter is required:

kernel.shmmax = 4294967295

These changes will go into effect after a reboot, but if you don't wish to reboot, you can activate them immediately by typing (as root):

/sbin/sysctl -p

Modify the /etc/security/limits.conf file (increase the shell limits):

# added for oracle
oracle           soft    nproc   2047
oracle           hard    nproc   16384
oracle           soft    nofile  1024
oracle           hard    nofile  65536

Modify the /etc/pam.d/login file (create it if doesn't already exist):

# added for oracle
session    required     /lib/security/pam_limits.so
session    required     pam_limits.so

Modify the /etc/profile file::

# added for oracle
if [ $USER = "oracle" ]; then
        if [ $SHELL = "/bin/ksh" ]; then
              ulimit -p 16384
              ulimit -n 65536
              ulimit -u 16384 -n 65536

Temporary Swap Space

If you find that you haven't setup quite enough swap space, or you're having strange errors occur during the install, then you can temporarily add more swap space like this (I needed to do this for the 64bit install):

dd if=/dev/zero of=tmpswap bs=1k count=900000
chmod 600 tmpswap
mkswap tmpswap
swapon tmpswap

Later, after the install, you can disable the temporary swap space execute like this:

swapoff tmpswap
rm tmpswap

Prerequisite Users and Groups

Run the following to add the required groups and users:

/usr/sbin/groupadd dba
/usr/sbin/groupadd oinstall
/usr/sbin/useradd -c "Oracle software owner" -g oinstall -G dba oracle
passwd oracle

Prerequisite Directories

Create the directory for the core Oracle installation:

mkdir -p /u01/app/oracle
chown oracle.oinstall /u01/app/oracle

Create the directory for the database files (to comply with Oracle's Optimal Flexible Architecture (OFA)):

mkdir -p /u02/oradata
chown oracle.oinstall /u02/oradata

Prerequisite Environment

Set the following environment variables as the oracle user:

su oracle
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=mydbname

To make these permanent:

cat >> ~oracle/.bash_profile << EOF
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=mydbname

Please note you must not have the LD_LIBRARY_PATH environment variable set before you start your installation (it causes an error involving ins_sysman.mk), To make sure, run this command: export LD_LIBRARY_PATH=

Installing Oracle

If you are running this remotely, make sure that you have an x-server installed, and are using "X11 forward" with ssh.

Download the oracle install from oracle.com.

I usually copy the downloaded file into the following folder: /u02/install (this and the unzipped files can be deleted after the install)

Unzip the file:

unzip 10201_database_linux32.zip

Or if you're going to be installing the 64bit version:

gunzip 10201_database_linux_x86_64.cpio.gz
cpio -idmv < 10201_database_linux_x86_64.cpio

This will create a database directory with all the required installation files. cd into that directory and run:

./runInstaller &

Welcome Screen Settings:

Basic Installation: Checked
Oracle Home Location: /u01/app/oracle/product/10.2.0/db_1
(the above will be /u01/app/oracle/product/11.2.0/dbhome_1/ for 11g)
Installation Type: Enterprise Edition
UNIX DBA Group: dba
Create Starter Databases: Not checked, I prefer to create it later using dbca

Specify Inventory directory and credentials settings:

Full path of the inventory directory: /u01/app/oracle/oraInventory
Specify Operating System group name:  oinstall

Then if all your prerequisites were set correctly, you should be able to select defaults until the end of the install.

Post Installation

Add the following to your ~oracle/.bash_profile file (for 10g):

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1

or this (for 11g):

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1/

Then run the above as commands from the command line.

Installing Oracle Patches or Upgrades

This is a good time to install any patches or upgrades to oracle (before you create the database), that way you won't need to patch the database too (all new databases will be created with the patched files).

Patches and Upgrades should be obtained from Oracle via My Oracle Support (you'll need to have an account with Oracle for this).

Please note that most patches (especially those using OPatch require the database instance and emctl to be stopped first.

Creating a Database

WARNING: Do Not Run dbca as root. To create a database, run: dbca & (remember to specify /u02/oradata for Database file location (in order to comply with OFA)).

Setup the listener by running: netca &

NOTE: if you are creating an instance for a Java (J2EE) online application, I have found that the following initialization parameters help to optimize performance for the instance:

open_cursors 1500
session_cached_cursors 2500
processes 650

Managing your Database

Starting up and shutting down the database:

sqlplus /nolog
SQL> connect / as sysdba
SQL> startup

sqlplus /nolog
SQL> connect / as sysdba
SQL> shutdown

These are the J2EE Applications that are deployed during the install process:

iSQL*Plus: http://servername:5561/isqlplus

iSQL*Plus DBA: http://servername:5561/isqlplus/dba

Enterprise Manager 10g Database Control: http://servername:1158/em

If you don't know which ports the above are on, do the following:

cat $ORACLE_HOME/install/portlist.ini

You can start and stop Enterprise Manager 10g Database Control with the following commands:

emctl start dbconsole
emctl stop dbconsole


To automatically start and stop the database, there are a few things you need to do, firstly, edit the file /etc/oratab and change the last parameter to Y as in the following example:


Then you need to create the file /etc/rc.d/init.d/dbora like so (remember change mydbname to your SID):

cat >/etc/rc.d/init.d/dbora
# dbora   This scripts starts and shuts down the 
# oracle database
# chkconfig: 345 99 10
# description: This script calls the dbstart script 
# to start Oracle and dbshut to stop it
# processname: oracle*
# config: /etc/oratab
# Set ORACLE_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 ORACLE_HOME.

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export ORACLE_SID=mydbname


if [ ! -f $ORACLE_HOME/bin/dbstart ]
  echo "Oracle startup: cannot start"

case "$1" in
  su $ORA_OWNER -c $ORACLE_HOME/bin/dbstart &
  su $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl start" &
  su $ORA_OWNER -c "$ORACLE_HOME/bin/emctl start dbconsole" &
  su $ORA_OWNER -c "$ORACLE_HOME/bin/emctl stop dbconsole" &
  su $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop " &
  su $ORA_OWNER -c $ORACLE_HOME/bin/dbshut &
  su $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop " &
  su $ORA_OWNER -c $ORACLE_HOME/bin/dbshut &
  sleep 15
  su $ORA_OWNER -c $ORACLE_HOME/bin/dbstart &
  su $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl start " &


Then make it executable:

chmod +x /etc/rc.d/init.d/dbora

Then add the file to services:

/sbin/chkconfig --add dbora

Also you may have to set these symbolic links:

ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora
ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora

Copy all the export oracle lines from ~oracle/.bash_profile to /etc/profile

Now this should all work, right? Well, not so fast; although just about everyone says it should work, doesn't mean it does. To get Oracle to really start at machine start do the following:

cat >> /etc/rc.d/rc.local
/etc/init.d/dbora start

Removing Oracle Software

You can use dbca to remove databases. If you want to uninstall other Oracle software (even the whole Oracle install), do the following:

emctl stop dbconsole
lsnrctl stop
isqlplusctl stop
searchctl stop

In the Welcome window, select Deinstall Products and follow the prompts.


I usually use samba so I can copy dumps etc. to and from the server from a windows pc. Here is the command-line way to do this (remember this is a development server, so security isn't as tight). I have a document on setting up samba here.


Oracle help can be found at the Oracle Technology Network, The Oracle Usenet Newsgroup, or just use Google.

© Roqet :: 2022-03-01 16:07:34