Linux Oracle HOWTO

Linux Oracle HOWTO

Install Oracle 8.0.5 for Linux on FreeBSD 3.1, step by step
pi@LF.net, Mon Feb 22 18:22:27 CET 1999


Part 0 (damn, those romans knew no zero): Introduction
------------------------------------------------------

This guide describes how to install Oracle 8.0.5 for Linux on FreeBSD 3.1.

Open issues:
- compiling perl DBD/DBI interface
- re-linking the Oracle database (done by orainst)

Other quite interesting informations can be found at:
- http://www.freebsd.org.ru/linux-oracle.HOW-TO.html, thanks to kan@sti.cz
  for this pointer
  http://www.wi.leidenuniv.nl/~mhmoolen/
  seems to be the original source for this.
- http://www.solik.net/oracle_letter.html
  some hints on Oracle/SCO for FreeBSD (some parts russian, *sigh*)
- ftp://ftp.oracle.com/pub/www/oracle8/linux/805ship.tgz
  As SCO/Oracle is available from ftp.oracle.com as well,
  this might be an interesting way.

Disk space requirements: approx. 1 GB disk space for light usage.
For testing purposes, approx. 820 MB seem to be sufficient.
Q: Why so much diskspace ?
A: Oracle needs a copy of the tape/cd-rom somewhere read-writeable
   in the filesystem (so-called staging area). This needs approx. 400 MB.

We assume the following environment variables:

	export ORACLE_OWNER=oracle

The userid that owns the binaries and the datasets.

	export ORACLE_SID=WHATEVER

Some sort of uniq database name. Given this, you can
have multiple databases on the same machine.

	export ORACLE_HOME=/usr/local/oracle

Where the binaries are located. There's a suggestion from
Oracle on filesystem layout called "Optimal Flexible Architecture" (OFA).
OFA is described in detail in Chapter 1 of the Oracle8 Administrator's
Reference for LINUX. 

	export ORACLE_TERM=xterm

The terminal type we need to run the installation script.
The installation script (orainst), runs on curses. Your mileage may vary.
[comment: setting "stty intr '^c' erase '^?'" in your .profile might
be useful, as well. orainst is picky on the erase character]

You can add those variables to your .bashrc (for every account that
will work with oracle!). Add /usr/local/oracle/bin to your $PATH,
if you do not want to type the whole path 8-)


Part I: How to install all this ?
---------------------------------

- Install FreeBSD 3.1 on a new machine, including the ports collection

- provide approx 1 GB of diskspace in the filesystem where Oracle
  will reside (approx. 500 MB for the installation, more
  if you need a copy of oracle (approx. 400 MB) in the staging area)

As root:

- Edit /etc/rc.conf and add:
  linux_enable="YES"
  ibcs2_enable="YES"

- Kernel configuration, add those parameters:

  o section for shared memory:

  options         SHMALL=4097
  options         SHMMAXPGS=4097
  options         "SHMMAX=(SHMMAXPGS*PAGE_SIZE+1)"

  o section for semaphores (values work, oracle needs approx. 100 semaphores)
    I do not understand the criterias for "correct" values here. They just
    have to be large enough

  options         SEMMAP=255
  options         SEMMNI=235
  options         SEMMNS=255
  options         SEMMNU=235 
  options         SEMMSL=255
  options         SEMOPM=201 
  options         SEMUME=201 

- compile the kernel, reboot

- Install the linux emu
  umask 022
  cd /usr/ports/emulators/linux
  make all install

- Add a unix group "dba" to /etc/group, like this:
  dba:*:82:oracle

- Add a unix user "oracle" to /etc/passwd, like this:
  oracle:somepassword:82:82::0:0:Oracle Owner:/home/oracle:/bin/bash

- create the oracle destination directory
  mkdir -p /usr/local/oracle/etc
  echo WHATEVER:/usr/local/oracle:Y >/usr/local/oracle/etc/oratab
  ln -s /usr/local/oracle/etc/oratab /etc/oratab
  chown -R oracle.dba /usr/local/oracle

- get yourself the large tar file, e.g.
  ftp://ftp.oracle.com/pub/www/oracle8/linux/805ship.tgz

- now continue as user oracle (not root)

- unpack the distribution
  mkdir ~/somedir
  cd ~/somedir
  tar xfvz somewhereelse/805ship.tgz

- start the orainst script
  cd ~/somedir/orainst
  ./orainst

- Now some comments on the following "dirty" part.
  orainst tries to re-link the applications, even while the tgz files
  provides all of them in (working) binary form.
  I do not know whether the installation is incomplete if the linking
  phase fails, so at the end is an appendix on how to get over the
  linking. See the appendix for details.
  Otherwise, you probably can work with installating,
  ignoring the linking errors and copy the pre-linked binaries into
  place. See below for details.

- First, we have to answer quite a few questions to orainst:
  step through orainst, using OK or the selection given below:

  o Custom Install (otherwise no 8bit character sets)
  o Install, Upgrade or De-Install Software
  o Install New Product - Do not Create DB Objects
  o Mount point: /usr/local/oracle
  o ORACLE_HOME location "/usr/local/oracle/app/oracle/product/": 8.0.5
  o Environment Variables:
    * ORACLE_BASE: /usr/local/oracle
    * ORACLE_HOME: /usr/local/oracle
  o Install Log: just keep the values
  o Install from: Staging Area (I had errors when I ran from the CD mount)
  o Enter Pathname of source staging:
    Enter the path to ~/somedir, in my case:
    /usr/local/users/support/oracle/src
  o Select native language: All Languages
  o Select all sw-products im Software Asset Manager
  o select group to act as DBA: dba
  o select the OSOPER Group: dba
  o Choose JDBC Components: select all
  o Pathname for ORACLE_DOC: /usr/local/oracle/doc
  o Formats of Dokumentation: html

- now orainst starts to copy lots of files around.
  sometimes it will complain about software not being linked
  or some make command that failed.
  Ignore those.

- After it installed all files, it will return you to the
  Software Asset Manager. Leave it. It will complain that
  some commands fail. Ignore this (untested).
  At the end, it should have created an $ORACLE_HOME/orainst/root.sh
  
- Copy the pre-compiled binaries from somedir/bin:

  cp ~/somedir/bin/* $ORACLE_HOME/bin/

- Fix orainst/root.sh:
1c1
< #!/usr/bin/sh
---
> #!/bin/bash
34c34
< CHOWN=/bin/chown
---
> CHOWN=/usr/sbin/chown

- as root: run orainst/root.sh 
  It will ask for a pathname to a local bin directory.
  I used "/usr/local/oracle/bin", $ORACLE_HOME/bin
  This will set some permissions (sbits for some binaries)
  Not yet checked in all detail: which ones and for what.

- You now have a working oracle setup.


Part II: How to get to the first "select" ?
-------------------------------------------

Some steps to a running database:

  cp dbs/init.ora dbs/initWHATEVER.ora
  edit initWHATEVER.ora, replace DEFAULT with WHATEVER
  bin/svrmgrl			# some prompt from svrmgrl comes up
  connect internal
  startup
  create database WHATEVER character set WE8ISO8859P1;
  alter tablespace SYSTEM 
        add datafile '/usr/local/oracle/dbs/dbs2WHATEVER.dbf'
        size 10M autoextend on;
  @$ORACLE_HOME/rdbms/admin/catalog.sql		# lots of messages, some errors
  @$ORACLE_HOME/rdbms/admin/catproc.sql		# ignore those
  @$ORACLE_HOME/sqlplus/admin/pupbld.sql
  quit

Now you should be able to:

  sqlplus sys/manager			# connects you to the database
  select * from tab;			# which tables are available ?
  quit					# and goodbye


Appendix: Getting Oracle to link
--------------------------------

This is really, really ugly. But it works for me.
It does not produce running binaries, but it lets orainst
end with "Result: sucess".

During orainst, the installation will report problems seven times:
- TNS Listener (this one can be ignored)
- Oracle Names
- wrap executable
- Oracle Trace
- Oracle8 Standard RDBMS
- Oracle Intelligent Agent
- SQL*Plus

For these to suceed, some changes have to be made to some
files, and the relevant command has to be used (manually).


Oracle Names:
- edit lib/sysliblist
  replace "-lnsl -lm"
  with:
  "/compat/linux/lib/ld-linux.so.2 /compat/linux/lib/libm.so.6 /compat/linux/lib/libdl.so.2 /compat/linux/lib/libpthread.so.0 /compat/linux/lib/libc.so.6 /compat/linux/lib/libnsl.so.1"
- edit network/lib/env_network.mk
150c150,151
< EXSYSLIBS= -ldl
---   
> # EXSYSLIBS= -ldl
> EXSYSLIBS=
223c224,225
< EXSYSLIBS=-ldl
---   
> # EXSYSLIBS=-ldl
> EXSYSLIBS=
632c634,635
< MY_TMP_FLAGS = -ldl -lc
---   
> # MY_TMP_FLAGS = -ldl -lc
> MY_TMP_FLAGS =
- run
  make -f ins_network.mk names_targs


wrap executable:
- set the value of the lib/sysliblist as described before
  (apparently, it was overwritten by something ? dunno)
- edit plsql/lib/env_plsql.mk
149c149,150
< EXSYSLIBS= -ldl
--- 
> # EXSYSLIBS= -ldl
> EXSYSLIBS=
222c223,224
< EXSYSLIBS=-ldl
---
> # EXSYSLIBS=-ldl
> EXSYSLIBS=
- run
  make -f ins_plsql.mk install


Oracle Trace:
- edit otrace/lib/env_otrace.mk
149c149,150
< EXSYSLIBS= -ldl
---
> # EXSYSLIBS= -ldl
> EXSYSLIBS=
222c223,224
< EXSYSLIBS=-ldl
---
> # EXSYSLIBS=-ldl
> EXSYSLIBS=
- run
  make -f /usr/local/oracle/otrace/lib/ins_otrace.mk install


Oracle8 Standard RDBMS:
- edit rdbms/lib/env_rdbms.mk
149c149,150
< EXSYSLIBS= -ldl
---
> # EXSYSLIBS= -ldl
> EXSYSLIBS=
222c223,224
< EXSYSLIBS=-ldl
---
> # EXSYSLIBS=-ldl
> EXSYSLIBS=
680c682,684 
< LDLIBS+=-ldl $(NETLIBS) $(NETLIBS) $(NETLIBS) $(NETLIBS) $(NETLIBS) \
---
> #LDLIBS+=-ldl $(NETLIBS) $(NETLIBS) $(NETLIBS) $(NETLIBS) $(NETLIBS) \
> #        $(LLIBSQL) $(LLIBSQL)
> LDLIBS+=$(NETLIBS) $(NETLIBS) $(NETLIBS) $(NETLIBS) $(NETLIBS) \
- run
  make -f ins_rdbms.mk install


Oracle Intelligent Agent:
- edit network/lib/env_oemagent.mk
149c149,150
< EXSYSLIBS= -ldl
---
> # EXSYSLIBS= -ldl
> EXSYSLIBS=
222c223,224
< EXSYSLIBS=-ldl
---
> # EXSYSLIBS=-ldl
> EXSYSLIBS=
477,478c479,482
< LIBTCL = /usr/lib/libtcl.so
< LLIBTCL = -ltcl
---
> #LIBTCL = /usr/lib/libtcl.so
> #LLIBTCL = -ltcl
> LIBTCL = /client/lib/libtcl.a
> LLIBTCL = /client/lib/libtcl.a
- compile tcl with a static library
  you can get tcl from
  ftp://ftp.scriptics.com/pub/tcl/tcl8_0/tcl8.0.4.tar.gz
  cd /tmp/
  tar xfvz tcl8*
  cd tcl*4
  ./configure
  make
  cp libtcl.a /client/lib/		# that's where I keep it
- edit network/lib/ins_oemagent.mk
27c27,28
< MY_TMP_FLAGS =-lm -ldl -lc -lcrypt
---
> # MY_TMP_FLAGS =-lm -ldl -lc -lcrypt
> MY_TMP_FLAGS =-lcrypt
- run
  make -f ins_oemagent.mk install


SQL*Plus:
- edit sqlplus/lib/env_sqlplus.mk
150c150,151
< EXSYSLIBS= -ldl
---
> # EXSYSLIBS= -ldl
> EXSYSLIBS=
223c224,225 
< EXSYSLIBS=-ldl
---
> # EXSYSLIBS=-ldl
> EXSYSLIBS=
- run
  make -f ins_sqlplus.mk install


If you now re-run orainst, it will end with:
Result: Success.

Leave a Reply

Your email address will not be published. Required fields are marked *