# Installing Oracle 9i How To

## squareHat

After a lot of research I was able to get Oracle 9i to install successfully on Gentoo. 

This is a summary of the extra little steps that I ended up following to get it to work. Thanks to all the people that provided the necessary clues.

I hope this helps.

I found this this guide a big help

http://www.puschitz.com/InstallingOracle9i.shtml

After downloading the software and extracting the software.

1. downgraded to an earlier version of binutils

```
emerge /usr/portage/sys-devel/binutils/binutils-2.13.90.0.18-r1.ebuild
```

After the install upgrade to again by emerge -u binutils

2. run the following script as root (thanks to funeagle)

```
#! /bin/bash

                                                                                                                                               

# This is the root script

                                                                                                                                               

# Creating Oracle User Accounts

groupadd dba  # group of users to be granted with SYSDBA system privilege

groupadd oinstall     # group owner of Oracle files

useradd -c "Oracle software owner" -m -g oinstall -G dba,users,audio oracle

echo "oracle user added, complete password"

passwd oracle

                                                                                                                                               

# Setting Shared Memory

echo "2147483648" > /proc/sys/kernel/shmmax

cat /proc/sys/kernel/shmmax

                                                                                                                                               

# Creating Oracle Directories

mkdir /opt/oracle

mkdir /opt/oracle/product

mkdir /opt/oracle/product/9.2.0

chown -R oracle.oinstall /opt/oracle

                                                                                                                                               

mkdir /var/oracleDB

chown oracle.dba /var/oracleDB

chmod 755 /var/oracleDB

chmod 777 /var/tmp #the listener needs access to /var/tmp

                                                                                                                                               

# Setting temp Swap Space if need

#cd /opt/oracle/

#dd if=/dev/zero of=orclswap bs=1k count=900000

#chmod 600 orclswap

#mkswap orclswap

#swapon orclswap

                                                                                                                                               

echo -e "\a"

                                                                                                                                               

echo "I needed to emerge /usr/portage/sys-devel/binutils/binutils-2.13.90.0.18-r1.ebuild"

echo "to do the install but upgrade to latest binutils when finished"

                                                                                                                                               

echo "Log on now as oracle using su - oracle"
```

3. run the following script as oracle (thanks again to funeagle)

```
#! /bin/bash

                                                                                                                                               

# This is the oracle user script

                                                                                                                                               

echo "# Set the LD_ASSUME_KERNEL environment new kernels" >> /home/oracle/.bashrc

echo "# Use the "Linuxthreads with floating stacks" implementation instead of NPTL:" >> /home/oracle/.bashrc

echo "export LD_ASSUME_KERNEL=2.4.1" >> /home/oracle/.bashrc

                                                                                                                                               

echo "# Oracle Environment" >> /home/oracle/.bashrc

echo "export ORACLE_BASE=/opt/oracle" >> /home/oracle/.bashrc

echo "export ORACLE_HOME=/opt/oracle/product/9.2.0" >> /home/oracle/.bashrc

echo "export ORACLE_SID=oracleDB" >> /home/oracle/.bashrc

echo "export ORACLE_TERM=xterm" >> /home/oracle/.bashrc

# export TNS_ADMIN= Set if sqlnet.ora, tnsnames.ora, etc. are not in

# $ORACLE_HOME/network/admin

echo "export NLS_LANG=AMERICAN;" >> /home/oracle/.bashrc

echo 'export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data' >> /home/oracle/.bashrc

echo 'LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib' >> /home/oracle/.bashrc

echo 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib' >> /home/oracle/.bashrc

echo "export LD_LIBRARY_PATH" >> /home/oracle/.bashrc

                                                                                                                                               

# Set shell search paths

echo 'export PATH=$PATH:$ORACLE_HOME/bin' >> /home/oracle/.bashrc

                                                                                                                                               

echo -e "\a"

echo "restart shell! & run install"
```

4. su - oracle N.B. the - is important and run the installer 

```
su - oracle

/somedirectory/Disk1/runInstaller
```

this is what I used my installation

- What would you like as the base directory (Inventory Location): /opt/oracle/oraInventory

- UNIX Group Name (permission for updating Oracle software): oinstall  

- Full path name for Oracle Home: /opt/oracle/product/9.2.0

- Oracle Database directory: /var/oracleDB/oradata

- standard database

5. As the installer proceeds you make get this error (I did)

 *Quote:*   

> "Error in invoking target install of makefile /opt/oracle/product/9.2.0/ctx/lib/ins_ctx.mk"

 

Edit the file $ORACLE_HOME/ctx/lib/env_ctx.mk, go to "INSO_LINK =", and add a "$(LDLIBFLAG)dl" to the line and save it.

Here is the full line with the added "$(LDLIBFLAG)dl" flag:

INSO_LINK = -L$(CTXLIB) $(LDLIBFLAG)m $(LDLIBFLAG)dl $(LDLIBFLAG)sc_ca ... and so on

and press Retry

6. The install should complete OK

6a. However I needed to add the following sym link so that dbstart would work

```
ln -s /opt/oracle/admin/oracleDB/pfile/initoracleDB.ora.1011200321914 /opt/oracle/product/9.2.0/dbs/initoracleDB.ora
```

7. Following is scripts that I have modified to start and stop the oracle

thanks to http://www.gurulabs.com/

/etc/init.d/oracle

```
#!/sbin/runscript

# 

# Startup script for Oracle 9i on Gentoo 

#

# Edit the /etc/oratab file. 

# Database entries in the oratab file appear in the following format: 

#    ORACLE_SID:ORACLE_HOME:{Y|N}

# where Y or N specifies whether you want the dbstart and dbshut

# scripts to start up and shut down the database.

#

# config: /etc/oratab

# config: /etc/conf.d/oracle

# config: /etc/profile.d/oracle.sh

#depend() {

#   after local

#}

# get and check environment (e.g. ORACLE_HOME)

test -f /etc/profile.d/oracle.sh && . /etc/profile.d/oracle.sh

if [ -z "$ORACLE_HOME" -o ! -d $ORACLE_HOME -o -z "$ORACLE_SID" ]; then

   echo "Cannot find ORACLE_HOME directory, or ORACLE_SID not set."

   echo -n "Environment settings are wrong? Check /etc/profile.d/oracle.sh"

   failure $"Checking Oracle environment"

   exit 1

fi

adjustKernel() {

   # Do these here instead of /etc/sysctl.conf since they are Oracle

   # specific, and we don't want to muck unless we are in fact going

   # to start Oracle

   echo -n $"Tuning kernel parameters for Oracle: "

   # Set shared memory parameters

   echo ${SHMMAX:-2147483648} > /proc/sys/kernel/shmmax

   echo ${SHMMNI:-4096}       > /proc/sys/kernel/shmmni

   # Set the semaphore parameters:

   # see Oracle release notes for Linux for how to set these values

   # SEMMSL, SEMMNS, SEMOPM, SEMMNI

   echo ${SEMMSL:-250} ${SEMMNS:-32000} ${SEMOPM:-100} ${SEMMNI:-128} > /proc/sys/kernel/sem

}

start() {

   ebegin "Starting Oracle 9i"

   # the database will not start if no entries in /etc/oratab are "Y"

   grep -s -q ":Y" /etc/oratab >&/dev/null || {

      echo -n "No entries in /etc/oratab are Y"

      failure $"Checking /etc/oratab"

        exit 1

   }

   if [ ! -f $ORACLE_HOME/bin/dbstart -o -z "$ORA_OWNER" ]; then

      echo "No such file: \$ORACLE_HOME/bin/dbstart"

        echo -n "Oracle could not be found (ORACLE_HOME wrong?)" 

        failure $"Checking for $ORACLE_HOME/bin/dbstart"

        exit 1

   fi

   adjustKernel

   su $ORA_OWNER -c "$ORACLE_HOME/bin/dbstart"

      

   if [ "${START_LISTENER:-no}" = "yes" ] && [ -x $ORACLE_HOME/bin/lsnrctl ]; then

      

      su $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl start"

   fi

   if [ "${START_AGENT:-no}" = "yes" ] && [ -x $ORACLE_HOME/bin/agentctl ]; then

      su $ORA_OWNER -c "$ORACLE_HOME/bin/agentctl start"

    fi

   if [ "${START_ORA_APACHE:-no}" = "yes" ] && [ -x $ORACLE_HOME/Apache/Apache/bin/apachectl ]; then

      # Note: This is because JServ thinks it needs X to resize and do other image file manipulation

      # supposedly ?

      test -z "$DISPLAY" && export DISPLAY=":42000.0"

      su $ORA_OWNER -c "$ORACLE_HOME/Apache/Apache/bin/apachectl start"

   fi

   

   if [ "${START_CMANAGER:-no}" = "yes" ] && [ -x $ORACLE_HOME/bin/cmctl ]; then

      su $ORA_OWNER -c "$ORACLE_HOME/bin/cmctl start"

   fi

   

   eend $?

}

stop() {

   ebegin "Stopping Oracle 9i"

   

   # the database will not stop if no entries in /etc/oratab are "Y"

   grep -s -q ":Y" /etc/oratab >&/dev/null || {

     echo -n "No entries in /etc/oratab are Y"

     failure $"Checking /etc/oratab"

     exit 1

   }

   if [ ! -f $ORACLE_HOME/bin/dbshut -o -z "$ORA_OWNER" ]; then

        echo "No such file: \$ORACLE_HOME/bin/dbstart"

        echo -n "Oracle could not be found (ORACLE_HOME wrong?)" 

        failure $"Checking for $ORACLE_HOME/bin/dbshut"

        exit 1

   fi

   if [ "${START_CMANAGER:-no}" = "yes" ] && [ -x $ORACLE_HOME/bin/cmctl ]; then

        su $ORA_OWNER -c "$ORACLE_HOME/bin/cmctl stop"

   fi

   

   if [ "${START_ORA_APACHE:-no}" = "yes" ] && [ -x $ORACLE_HOME/Apache/Apache/bin/apachectl ]; then

      # Note: This is because JServ thinks it needs X to resize and do other image file manipulation

       # Crazy, I know.  Needed for stopping too??? supposedly ?

       test -z "$DISPLAY" && export DISPLAY=":42000.0"

      su $ORA_OWNER -c "$ORACLE_HOME/Apache/Apache/bin/apachectl stop" > /dev/null 2>&1

   fi

   if [ "${START_AGENT:-no}" = "yes" ] && [ -x $ORACLE_HOME/bin/agentctl ]; then

      su $ORA_OWNER -c "$ORACLE_HOME/bin/agentctl stop"

   fi

   if [ "${START_LISTENER:-no}" = "yes" ] && [ -x $ORACLE_HOME/bin/lsnrctl ]; then

      su $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop"

   fi

      su $ORA_OWNER -c "$ORACLE_HOME/bin/dbshut"

   eend $?

}
```

/etc/conf.d/oracle

```

#

# Start Oracle

# (Note: the environment variables are set in /etc/profile.d/oracle.sh)

#

START_ORACLE="yes"

#

# Owner of Oracle installation (oracle will be started as that user)

#

ORA_OWNER=oracle

#

# Only done if START_ORACLE is "yes": start listener

# to allow other computers to connect to the database

#

START_LISTENER="yes"

#

# Only if START_ORACLE is "yes": start Oracle

# Intelligent Agent (if installed)

#

START_AGENT="yes"

# 

# Only if START_ORACLE is "yes": start 

# the Apache that comes bundled with Oracle

# 

START_ORA_APACHE="no"

#

# Only done if START_ORACLE is "yes": start Connection Manager to

# allow other computers to connect to the database across a NAT type network

#

START_CMANAGER="no"

#################################################

# Set the kernel parameters

# Have a look at the Oracle ReleaseNotes for the Oracle product you are

# using for how to set these values. If you do not set them we will assume

# some reasonable defaults for a small Oracle 9i database system.

# 

# 1) max. shared memory available (does not mean that much is used)

# Enable use of up to 2 GB shared memory.

# Note: you don't have to use that much, this

# parameter only sets the maximum, that's it...

#

# You probably have to relink Oracle to get an Oracle SGA size

# larger than 512 MB. See the Oracle Admin. Guide, section

# "Relocating the SGA" for what to do. That was true for 8i,

# check 9i docs for how it works there.

# 

SHMMAX=2147483648

SHMMNI=4096

# 

# 2) sempahore values

# 

SEMMSL=250

SEMMNS=32000

SEMOPM=100

SEMMNI=128
```

/etc/profile.d/oracle.sh

```
# Environment for Oracle

# change these settings according to your installation

ORACLE_HOME=/opt/oracle/product/9.2.0

ORACLE_SID=oracleDB

ORACLE_BASE=/opt/oracle

# CONFIRM and check the path to the SDK

PATH=$PATH:$ORACLE_HOME/bin

TNS_ADMIN=$ORACLE_HOME/network/admin

ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib

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

ou

export ORACLE_BASE ORACLE_HOME ORA_NLS33 ORACLE_SID PATH LD_LIBRARY_PATH CLASSPATH TNS_ADMIN

ORACLE_TERM=xterm; export ORACLE_TERM

#NLS_LANG=american_america.AL32UTF8; export NLS_LANG

```

If you have a problem creating the 'starter datbase' you can either

```
#touch /etc/rac_on      thanks to MadEagle
```

or you can edit

$ORACLE_HOME/bin/dbca like so

 *Quote:*   

> #if [ -f /etc/rac_on ]; then
> 
> # Run DBCA
> 
> $JRE_DIR/bin/jre -native -DORACLE_HOME=$OH -DJDBC_PROTOCOL=thin -mx64m -classpath $CLASSPATH oracle.sysman.assistants.dbca.Dbca $ARGUMENTS
> ...

 

I would like to thank the authors of the following for the information and scripts 

http://www.puschitz.com/InstallingOracle9i.shtml

http://www.gurulabs.com/oracle-linux.html[/quote]Last edited by squareHat on Sun Mar 21, 2004 11:58 pm; edited 5 times in total

----------

## ebrostig

Great job!

Just a few comments on the FAQ:

1. The creation of a separate swap file is not necessary as long as you have a large enough swap partition.

2. ORACLE_TERM is not necssary

3. NLS_LANG is not necessary unless your settings is different from the default. Besides, NLS_LANG should be on the following format:

NLS_LANG=american_america.we8iso8859p1

The first part, american, indicates the language of error messages. The second part, america, indicates the date and time format and sort order. The last part is the characterset used, here we8iso8859p1. See the Oracle Globalization Guide for other values for the variable. (The documentation is part of the CD set)

4. If you don't set NLS_LANG, you can also drop ORA_NLS33.

5. The connection manager is not necessary unless you use the connection manager to pass through a firewall or where you have a multitude of Oracle databases and you are using some form of single sign on.

6. I would recommend starting the Agent as it is used by Enterprise Manager and used to monitor and to submit jobs.

Erik

----------

## MadEagle

Just a minor add-on that helped me:

If you want to use the graphical admin tools (like dbca) you have to create the file /etc/rac_on with 

```
touch /etc/rac_on
```

, otherwise the call to Oracles own JRE segfaults.

MadEagle

----------

## leon_73

Great tip !

Thanks!!!   :Smile:   :Smile:   :Smile: 

But do you think it works also with the  10g?

Leo

----------

## MadEagle

 *leon_73 wrote:*   

> 
> 
> But do you think it works also with the  10g?
> 
> 

 

I have no idea, haven't tried it yet.

MadEagle

----------

## Whoo

Hi for the new installer ... 10.x.x 

You sould type somthing like this :

 echo "redhat-2.1" > /etc/redhat-release

 :Smile: 

----------

## gnork

Hi, all!

Im trying to install 10g on Gentoo (running AMD64-Linux on a SunFire). Does anyone know, if/when the AMD64 version of 10g will be available? 

Meanwhile I tried 9.2.0.4(AMD64) and 10.1.0 (32bit). Both report the same error on startup of the OUI. It complains about missing libXp.so.6. The strange thing is, I have LD_LIBRARY_PATH set to "/usr/lib:/usr/X11R6/lib64:/usr/local/lib", deleted and recreated ld.so.cache and checked > 10 times, that libXp.so* exists.

Still, both OUIs complain:

```
Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/OraInstall2004-09-08_03-17-15PM/jre/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory
```

Any hint is apreciated,

TIA

Gnork

----------

## theonlymcc

Does this install the whole database or just the client. I just need the client.

----------

## javilon

I have tried 10g on a AMD64 Gentoo and get the same problem as gnork:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/OraInstall2004-09-08_03-17-15PM/jre/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory

First, I didn't have the library libXp.so.6. When I looked for it, it seems to be on the xprint package, so I tried to install it. It failed with a compilation error. 

Searching through debian forums I found a patch that makes xprint 0.9.0 compile for AMD64, aply it and got it compiled and installed.

I assumed that this would solve my problem, but it doesn't. I still get the UnsatisfiedLineError although I am sure that I have libXp.so.6 on the library search path.

Did anyone manage to install any version of Oracle on Gentoo AMD64?

----------

## javilon

I have installed the 32 bit compatability packages on my gentoo and the  problem whith the exception:

java.lang.UnsatisfiedLinkError: /tmp/OraInstall2004-09-08_03-17-15PM/jre/lib/i386/libawt.so: libXp.so.6

has gone away.  I can now run the installer.

The info was on the Gentoo FAQ for amd64 on this same forum.

Regards, 

Javier

----------

## theonlymcc

Anyone know if it is possible to install 9i with glibc 2.3.4?

----------

## bravecobra

try this instead: http://gentoo-wiki.com/HOWTO_Install_Oracle_10g

----------

## gatorex

There was a linux mag, that had a good tutorial for install 9i, and it took care of this error:  

Quote:

"Error in invoking target install of makefile /opt/oracle/product/9.2.0/ctx/lib/ins_ctx.mk"

When I find in my mess of a desk, I will post it.

By the way, good howto.

----------

## eltebe

hi

i cant do 

emerge /usr/portage/sys-devel/binutils/binutils-2.13.90.0.18-r1.ebuild

i use gentoo 2004.3 stage1 with kde 

my oui hangs on 

installing java runtime env...

link pending

copying jre

eighter it's database nor client only

here's a log tail

```
bash-2.05b# tail -n 50  /home/oracle/oraInventory/logs/installActions2005-01-04_02-59-24AM.log

    Oracle Net Required Support Files 9.2.0.4.0

    Oracle Network Utilities 9.2.0.1.0

    Oracle Trace Required Support Files 9.2.0.4.0

    Oracle9i Client 9.2.0.4.0

    Oracle9i Globalization Support 9.2.0.4.0

    PL/SQL Required Support Files 9.2.0.4.0

    Parser Generator Required Support Files 9.2.0.1.0

    Platform Required Support Files 9.2.0.1.0

    Precompiler Common Files 9.2.0.4.0

    Precompiler Required Support Files 9.2.0.4.0

    RDBMS Required Support Files 9.2.0.4.0

    Recovery Manager 9.2.0.4.0

    Required Support Files 9.2.0.1.0

    SQL*Loader 9.2.0.4.0

    SQL*Plus 9.2.0.4.0

    SQL*Plus Required Support Files 9.2.0.4.0

    SSL Required Support Files 9.2.0.4.0

    Sun JDK 1.3.1.0.1a

    Sun JDK extensions 9.2.0.4.0

    Utilities Common Files 9.2.0.4.0

    Visigenics ORB 3.4.0.0.0

    XDK Required Support Files 9.2.0.4.0

*** Install Page***

Starting install install phase 1 of component Java Runtime Environment

Calling action fileActions2.2.0.14.0  finalClusterSetup

        selectedNodes =

        threadsActive = 2

        vectorInitialSize = 50

        vectorFactorSize = 25

Calling action fileActions2.2.0.14.0  copyExpandedGroup

        selectedNodes =

        copyGroup = bin

        permissions = 775

        owner = null

        group = null

        copyAsText = null

        groupRelLoc = .

        gpEntries = [[bin/i686/native_threads/jre ->%PROD_HOME%/bin/i686/native_threads/jre 73785 plats=0=>[46] langs=0=>[en]]

, [bin/i686/native_threads/.extract_args ->%PROD_HOME%/bin/i686/native_threads/.extract_args 423 plats=0=>[46] langs=0=>[en]]

, [bin/i686/native_threads/javakey ->%PROD_HOME%/bin/i686/native_threads/javakey 316 plats=0=>[46] langs=0=>[en]]

, [bin/i686/native_threads/rmiregistry ->%PROD_HOME%/bin/i686/native_threads/rmiregistry 314 plats=0=>[46] langs=0=>[en]]

, [bin/i686/green_threads/jre ->%PROD_HOME%/bin/i686/green_threads/jre 73720 plats=0=>[46] langs=0=>[en]]

, [bin/i686/green_threads/.extract_args ->%PROD_HOME%/bin/i686/green_threads/.extract_args 423 plats=0=>[46] langs=0=>[en]]

, [bin/i686/green_threads/javakey ->%PROD_HOME%/bin/i686/green_threads/javakey 316 plats=0=>[46] langs=0=>[en]]

, [bin/i686/green_threads/rmiregistry ->%PROD_HOME%/bin/i686/green_threads/rmiregistry 314 plats=0=>[46] langs=0=>[en]]

, [bin/jre ->%PROD_HOME%/bin/jre 2302 plats=0=>[46] langs=0=>[en]]

, [bin/.java_wrapper ->%PROD_HOME%/bin/.java_wrapper 3481 plats=0=>[46] langs=0=>[en]]

]

        DllGroup = false

```

the file seems to be in a right place

but it's not working  :Sad: 

i tried deleting all files from tmp orainventory opt/oracle

nothing helped

if it's binutils fault then what do i have to do to downgrade since there is not ebuild in my portage directory

i downgraded gcc to 2.95.3 already

done scripts for oracle and root 

fixed few errors 

greetz

----------

## eltebe

ok i changed few things 

and i get now 

```
Exception thrown from action: copyExpandedGroup

Exception Name: SetFilePermissionException

Exception String: Error in setting permissions of file/directory /home/oracle/jre/1.1.8/LICENSE

```

which directories should be owned by who(u/g)

and what are env names of those dirs

thx

----------

## eltebe

ok i finally solved the problems myself  :Very Happy: 

two things were crucial:

THREADS_FLAG=native

and 

libcwait.c ftp://people.redhat.com/drepper/libcwait.c

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

$THREADS_FLAG=native LD_PRELOAD=/ora/Disk1/libcwait.so ./runInstaller

$THREADS_FLAG=native LD_PRELOAD=/ora/Disk1/libcwait.so dbca

greetz & have fun with Oracle  :Very Happy: 

----------

## ova

I'd like to note about problems I had during installation.

All Configuration Assistants failed to start with such error:

```
jre was not found in /opt/u01/oracle/jre

```

The sollution was to create in /opt/u01/oracle/oracle.swd.jre/bin/i386/native_threads/jre

dirrectory a soft link from jre on java:

```

$ cd ${ORACLE_HOME}/oracle.swd.jre/bin/i386/native_threads/

$ln -s java jre

```

That is all. May be this is a known problem, but I takes me a lot of time to find the sollution.

----------

## bravecobra

Is your jre configured correctly with java-config?

----------

## ova

AFAIK Oracle comes with it's own jre (IBM?), so I do not need to install java at all.

Here on the forums there were advices to unset JAVA_HOME and other java realted environment variables to avoid some problems. So I simply did not install java at all.

So what do you mean by your question?

BTW with sun-jdk installed I had the same result.

----------

## sidhighwind

does have have to be installed to get this to work?  I don't see anything in here about that and I dont really want to install x on my machine.

Thanks.

----------

