Oracle 9i under Fedora Core 3 - Installation HOWTO

Gaurav Prasad

2005-06-27

Revision History
Revision v1.02005-06-22Revised by: MG
For inclusion in TLDP: Completed XML article structure with articleinfo, section IDs for cross-referencing; technical, language, grammar and spelling review.
Revision v1.0-pre12005-04-01Revised by: GP
Added miscellaneous errors section.
Revision v0.12005-03-25
First publication.

This tutorial describes how to install Oracle 9i on Fedora Core 3 or greater.


Table of Contents
1. 1. Introduction
1.1. What you need to know
1.2. Acknowledgments
1.3. Availability and Feedback
1.4. Licensing Information and Liability
2. Get Oracle 9i
2.1. CD Installation
2.2. Download
2.3. Install
3. Prepare for Configuration
3.1. Create Users and Groups
3.2. Create Directories
4. Set Environment Variables
5. Set Kernel Parameters
5.1. Edit /etc/sysctl.conf
5.2. Edit /etc/security/limits.conf
6. Install GCC 2.9 Compat libraries
6.1. Install GCC 2.96 Compat packages
6.2. Create symbolic links
7. Run Installer
7.1. Apply the libwait.c patch
7.2. Configure the Display
7.3. Start the Installation
7.4. Fix nodeinfo
8. Create a Startup Script
9. Miscellaneous Errors

1. 1. Introduction

1.1. What you need to know

This tutorial was written due to my frustration on installing Oracle 9i on FC3. Basically 9i installation on RAS 1,2,3 RH 9, FC1, FC2 is documented fairly well but it is hard to find anything worthwhile on FC3; some people even suggested that installing Oracle 9i on FC3 is not possible. This HOWTO attempts to condense all my experience and findings with any such info peculiar to FC3, which was before scattered all over the web, into one concise but useful document.

I hope you will find this short tutorial useful.

If you need to install Oracle 9i on FC3, you should be aware of the following facts:

  1. Fedora is not *Officially Supported* by Oracle Corp.

  2. Oracle 9i installation is difficult but possible on FC3.

  3. Oracle 9i CANNOT be linked with the libraries used by gcc 3.4. On FC3 you need to use the FC2 GCC compat libraries.

  4. The Oracle 10 G installation method does NOT WORKS with 9i.

  5. This HOWTO deals with RedHat products >= FC3 or higher or gcc version greater than 2.9. If you are installing any other RedHat product you might want to have a look at other excellent tutorials, for instance http://www.puschitz.com/OracleOnLinux.shtml and http://oracle-base.com/.

Also keep in mind:

  1. This HOWTO aims only to assist you. This is not an OFFICIAL Oracle document.

  2. I am not a DBA. Please do not contact me for matters other than the content of this document. I will not help you to set up your database. If you need help with that, check the Oracle forums.

  3. The next step for me is probably to write some Bash or Perl scripts to fully automate this tedious and boring, frustrating, manual process but that depends on spare time I get. Your ideas are welcome.


1.2. Acknowledgments

I would like to thank Jean François for helping me out with the most tricky parts.


1.3. Availability and Feedback

The latest version can be found at http://www.pagux.com/oracle9ionfedora3.html.

I rely on you, the reader, to make this HOWTO useful. If you have any suggestions, corrections or comments, please send them to me and I will try to incorporate them in the next revision.


1.4. Licensing Information and Liability

Copyright 2005 Gaurav Prasad

This HOWTO is free documentation; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. A copy of the license is available at http://www.gnu.org/copyleft/fdl.html.

This document is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. No liability for the contents of this document can be accepted. Use the concepts, examples and information at your own risk. There may be errors and inaccuracies, that could be damaging to your system. Proceed with caution, and although accidents are highly unlikely, the author(s) do not take any responsibility.

Linux is a registered trademark of Linus Torvalds.

All copyrights are held by their by their respective owners, unless specifically noted otherwise. Use of a term in this document should not be regarded as affecting the validity of any trademark or service mark. Naming of particular products or brands should not be seen as endorsements.


2. Get Oracle 9i

2.1. CD Installation

If you got Oracle 9i on a CD then mount it:

mount -r -o loop=/dev/loop0 ora9id1.iso Disk1/


2.3. Install

Extract all three files:

gunzip ship_9204_linux_disk1.cpio.gz

cpio -idmv -I ship_9204_linux_disk1.cpio

Don't forget the -I option or you will get errors during the extraction.

This command will expand the cpio archive to the Disk1 directory. Repeat the process for the other two archives.


3. Prepare for Configuration

3.1. Create Users and Groups

Execute the following commands as root:


# groupadd oinstall
# groupadd dba
# groupadd oper
# groupadd apache
# useradd -g oinstall -G dba oracle
# passwd oracle

Set the password for user oracle.


3.2. Create Directories

The final destination of the software will be here:


# mkdir /u01 /u02
# chown oracle.dba /u01 /u02
# chmod 755 /u01 /u02

4. Set Environment Variables

Log in as the oracle user:

su - oracle

Edit .bash_profile in oracle's home directory and add the following, for instance using vim:


########## Oracle Variables ##########
echo " Welcome to oracle";
ORACLE_BASE=/u01/app/oracle
ORACLE_OWNER=oracle; export ORACLE_OWNER
ORACLE_TERM=xterm; export ORACLE_TERM
ORACLE_HOME=/u01/app/oracle/product/9.2.0.1.0
ORACLE_SID=ORTD
LD_PRELOAD=$HOME/libcwait.so
export DISPLAY=172.28.66.39:0.0
PATH=$PATH:$ORACLE_HOME/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib:$ORACLE_HOME/network/lib

CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export CLASSPATH

LD_ASSUME_KERNEL=2.4.1; export LD_ASSUME_KERNEL
THREADS_FLAG=native; export THREADS_FLAG
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

export PATH ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH LD_PRELOAD
########## End of Oracle variables ##########

5. Set Kernel Parameters

5.1. Edit /etc/sysctl.conf

Add the following lines to the /etc/sysctl.conf file:


kernel.shmmax = 2147483648
kernel.shmmni = 128
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000

5.2. Edit /etc/security/limits.conf

Additionally the following lines can be added to the /etc/security/limits.conf file:


oracle soft nofile 65536
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384

Adding lines into these files requires a reboot before the new settings take effect.


6. Install GCC 2.9 Compat libraries

6.1. Install GCC 2.96 Compat packages

From Fedora Core TWO:

  • compat-libstdc++-7.3-2.96.126.i386.rpm

  • compat-libstdc++-devel-7.3-2.96.126.i386.rpm

  • compat-gcc-7.3-2.96.126.i386.rpm

  • compat-gcc-c++-7.3-2.96.126.i386.rpm

CautionDon't overwrite existing packages
 

Make sure that you keep your existing GCC installation, or a large part of your software will not work or can not be compiled any more. In case these packages are already installed on your system with newer version numbers, use rpm -i --force to install the older ones next to the newer ones.

From the Fedora Core THREE subtree, get the compat-db package.

If you don't install GCC compat libraries as above you get a zillion linking errors.


6.2. Create symbolic links

Put gcc296 and g++296 first in your $PATH variable by creating the following symbolic links:


# mv /usr/bin/gcc /usr/bin/gcc323
# mv /usr/bin/g++ /usr/bin/g++323
# ln -s /usr/bin/gcc296 /usr/bin/gcc
# ln -s /usr/bin/g++296 /usr/bin/g++

Note that should you already have upgraded your system, GCC versions might be different.


7. Run Installer

7.1. Apply the libwait.c patch

Before running the installer, do the following in order to overcome some weird errors:

  • In /home/oracle,create a file name libwait.c and as described below and compile it :

    Ceate a file called libcwait.c in the
    oracle
    user's home directory to avoid getting
    an error when running the Oracle installer. The libcwait.c file should contain the
    following text:
    /*
    gcc -O2 -shared -o $HOME/libcwait.so -fpic $HOME/libcwait.c
    */
    #include
    #include
    #include
    Deploying Oracle 9i on Red Hat Enterprise Linux AS 3
    Page 11
    #include
    pid_t
    __libc_wait (int *status)
    {
    int res;
    asm volatile ("pushl %%ebx\n\t"
    "movl %2, %%ebx\n\t"
    "movl %1, %%eax\n\t"
    "int $0x80\n\t"
    "popl %%ebx"
    : "=a" (res)
    : "i" (__NR_wait4), "0" (WAIT_ANY), "c" (status), "d" (0), "S" (0));
    return res;
    }
    Next, compile this file in the
    oracle
    user's home directory by executing the
    following command:
    gcc -02 -shared -o $HOME/libcwait.so -fpic $HOME/libwait.c
    

    gcc -shared -o libcwait.so libcwait.c -fpic -O

  • Then add this library to the environment of the database user:

    export LD_PRELOAD=/home/oracle/libcwait.so

    Earlier, we put a similar line in .bash_profile.


7.2. Configure the Display

Execute the following commands as oracle User :


oracle@9iserver ~> xhost +localhost
oracle@9iserver ~> export DISPLAY=localhost:0.0

You can now connect to your desktop or optionally run the installation remotely, for instance using VNC.for instance running the installer from your Windows desktop


7.3. Start the Installation

Start the graphical installation application:

/path/to/oracle/Disk1/runInstaller

Now carry with Graphical setup (if you are not sure choose Standard database). From here the rest of the installation process is obvious.


7.4. Fix nodeinfo

Now installation should proceed without any linking errors but you will get one error in the end:


Parameter "nodeinfo" = NO_VALUE
Agent Service Failed

In order to fix this, run the following for starting the wizard after setup has finished:

netca &

Now change into $ORACLE_HOME and run ./lsnrctl start.

Check that the process is running:

ps afx | grep LISTEN


8. Create a Startup Script

In order for the Oracle server to start automatically at system boot time, create the file /etc/init.d/oracle like this:


#!/bin/bash
#
# Run-level Startup script for the Oracle Instance and Listener
#
# chkconfig: 345 91 19
# description: Startup/Shutdown Oracle listener and instance

ORA_HOME="/u01/app/oracle/product/9.2.0.1.0"
ORA_OWNR="oracle"

# if the executables do not exist -- display error

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

# depending on parameter -- startup, shutdown, restart 
# of the instance and listener or usage display 

case "$1" in
    start)
        # Oracle listener and instance startup
        echo -n "Starting Oracle: "
        su - $ORA_OWNR -c "$ORA_HOME/bin/lsnrctl start"
        su - $ORA_OWNR -c $ORA_HOME/bin/dbstart
        touch /var/lock/subsys/oracle
        echo "OK"
        ;;
    stop)
 	# Oracle listener and instance shutdown
        echo -n "Shutdown Oracle: "
        su - $ORA_OWNR -c "$ORA_HOME/bin/lsnrctl stop"
        su - $ORA_OWNR -c $ORA_HOME/bin/dbshut
        rm -f /var/lock/subsys/oracle
        echo "OK"
        ;;
    reload|restart)
        $0 stop
        $0 start
        ;;
    *)
        echo "Usage: $0 start|stop|restart|reload"
        exit 1
esac
exit 0

Now run chkconfig oracle for updating the run level information.

Try service oracle start|stop|restart to check that everything works as expected now.

If you reached this step without errors: congratulations. Else, check Section 9 for troubleshooting suggestions.


9. Miscellaneous Errors

ERROR:


ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory 

This error happens when you reboot and try to login. You will get lots of errors when the database instance is not mounted/started automatically.

Solution:

  1. Check /etc/oratab and make sure that *:/opt/oracle/OraHome1 and ordb:/opt/oracle/OraHome1 are set to "Y" (YES).

  2. Try to initialize the database: $ORACLE_HOME/bin/dbstart.

ERROR:


No start entry for SID * at /opt/oracle/OraHome1 in /etc/oratab

This might be caused by a bug in the dbstart script which searches for the sid file in the wrong place.

Solution:

  1. cp $ORACLE_BASE/admin/$ORACLE_SID/pfile/init_*.ora \

    $ORACLE_HOME/dbs/init$ORACLE_SID.ora

  2. As user oracle:

    
$ sqlplus
    SQL> create pfile from spfile;
    SQL> exit
    
  3. Run the dbstart script: $ORACLE_HOME/bin/dbstart.