Saturday, October 13, 2007

Installing ORACLE 9i on Linux

Installing Oracle9i on RedHat Linux (or Similar)

This document describes how to install Oracle9i (9.0.1) on Redhat Linux ( or similar).
by Mark Kirkwood
(July 29th, 2001)

Introduction
This version of Oracle is easier to install than many of the previous ones. However there are still some traps and issues to get around. if you just need a database with transaction support, get Postgresql (www.postgresql.org) - it is very easy to install.
Before You Get Oracle
This release recommends 512 Mb of RAM, 1 GB of swap and 3 GB of disk ! You can get away with 320 MB, 750 Mb and 2.5 Gb respectively - provided you do not attempt to create a database at install time (wait until later !)
Do not attempt to install at all if you have less than 200 Mb of RAM as the installer will crash at link time ! (If you are an Oracle install pro then you can link manually to complete the process, but its a bit of a pest).

This release requires a 2.4.4 Kernel and Glibc 2.2.2. However you can install with 2.4.2 (Redhat 7.1) or 2.4.3 (Mandrake 8.0) Kernels.

There is an undocumented dependency on Binutils. The version that comes with Redhat 7.1 causes Oracle to be unlinkable. The solution is to use the version that comes with Redhat 7.0 (binutils-2.10.0.18) or Mandrake 8.0 (binutils-2.10.1.0.2).

The tested combinations were :

Redhat 7.0 with binutils-2.10.0.18
Mandrake 8.0 with binutils-2.10.1.0.2.
Getting Oracle
Visit www.oracle.com and click on "Oracle technology Network". The current URL for downloads is here. Select "9i Database" and then pick the "Linux" entry. You must then agree to the license before the actual download page appears.
There are three big files :

Linux9i_Disk1.cpio.gz (400Mb)
Linux9i_Disk2.cpio.gz (620 Mb)
Linux9i_Disk3.cpio.gz (80 Mb)
They are actually cpio archives ( not gzipped cpio archives ! ). You need fast internet access...or a friend with fast internet access.
Once downloaded then expand the archives somewhere where you have 2 GB of space :

# cd /var/bigspace
# cpio -idmv Linux9i_Disk1.cpio.gz
# cpio -idmv Linux9i_Disk2.cpio.gz
# cpio -idmv Linux9i_Disk3.cpio.gzThese expanded archives can be burned to three CDs to provide a convenient and professional looking installation.
Preparation
Decide where you want Oracle to be installed and create a directory for it ( I use /usr/oracle/[version] but its up to you). In addition create a group and user for Oracle (login as root for this) :
# groupadd dba
# useradd oracle
# mkdir /usr/oracle
# mkdir /usr/oracle/9.0
# chown -R oracle:dba /usr/oracleRemember you need 3 GB or so !
In addition I usually create the file /etc/oratab used to record databases :

# touch /etc/oratab
# chown oracle:dba /etc/oratabThere is some folklore about setting a plethora of environment variables and a thing called "Optimal Flexible Architecture". This business is best summed up by saying : The procedure is neither optimal, flexible nor an architecture... but a way of laying out files that some Oracle folk like.
Ensure that you have installed X on your machine, as there is no longer a character mode installer.

Oracle, like most databases, needs to use IPC to create shared memory. Typically the default amount configured on most Linux distributions is minimal. To sort this out : ( as root here )

# sysctl -w kernel.shmmax=100000000
# echo "kernel.shmmax = 100000000" >> /etc/sysctl.confThis enables a shared memory segment to be 100 Mb ( probably enough to start you off...)
Installation
Login as oracle and proceed to install :
$ cd /var/bigspace
$ cd Disk1
$ export ORACLE_HOME=/usr/oracle/9.0
$ ./runInstallerThe Java Gui installer will start and guide you through the process.
This part is now fairly easy - just pick "9i Database", then either of "Enterprise" or "Standard Edition" depending whether you want all the fancy bits or not ( bitmap indexes, partitions, transportable tablespaces etc require Enterprise Edition).

The next step asks about what database you want, I usually say "Software Only" and do the database later.

You will be asked where JDK is... if you don't have a JDK it does not matter ( unless you wish to do Java development of course).

Then click on install and wait for a while.

At some point you will be asked about the "other locations" for the remaining software archives.. its fairly straightforward what to be there ( if you have cut CDs, ensure your terminal window is not still cd'ed into the cdrom mount directory... )

Post Installation
Now comes creating a database. There is a reasonable Gui tool for this :
$ export PATH=$PATH:$ORACLE_HOME/bin
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
$ dbca &Additionally there is a network configuration tool with a similar UI :
$ netca &However I will detail a command line creation and configuration of a database so that some understanding of what is happening can be gained:
Set up configuration for a database called db1 :

$ cat "db1:/usr/oracle/9.0:Y >> /etc/oratab"
$ cd $ORACLE_HOME/dbs
$ cat initdw.ora sed s/"#db_name = MY_DB_NAME"/"db_name = db1"/sed s/#control_files/control_files/ > initdb1.oraStart and create database :
$ export PATH=$PATH:$ORACLE_HOME/bin
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
$ export ORACLE_SID=db1
$ sqlplus /nolog < $ORACLE_HOME/network/admin/listener.ora $ lnsrctl start $ echo "DB1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = <>)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = db1)))" > $ORACLE_HOME/network/admin/tnsnames.oraThese two commands tell the network listener where to listen, and clients were to send connection requests to. This can be tested by :
$ tnsping db1 1This should return (ok) [number]
Housekeeping
It is easy to make Oracle start automatically. Create a script called oracle in /etc/init.d that is like : ( you need to be root here )
#!/bin/sh
#
# oracle This shell script takes care of starting and stopping
# the oracle services.
#
# chkconfig: 345 90 10
# description: Oracle server
#
# probe: true

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
if [ ! -f /etc/sysconfig/network ]; then
exit 0
fi

# Check for echo -n vs echo \c
if echo '\c' grep -s c > /dev/null 2 > &1 ; then
ECHO_N="echo -n"
ECHO_C=""
else
ECHO_N="echo"
ECHO_C='\c'
fi



# See how we were called.
case "$1" in
start)
# Start server.
$ECHO_N "Starting Oracle: "$ECHO_C
su -l oracle -c sqlplus /nolog >/dev/null < ;; stop) # Stop server. $ECHO_N "Stopping Oracle: "$ECHO_C su -l oracle -c sqlplus /nolog > /dev/null < ;; *) echo $"Usage: $0 {startstop}" exit 1 ;; esac exit 0Then tell the system to run it : ( as root again ) # chkconfig --add oracleIt is nice to set up the Oracle .bash_profile to get ORACLE_SID and PATH working by default : # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi export BASH_ENV=$HOME/.bashrc export ORAENV_ASK=NO export ORACLE_SID=db1 if [ -f /usr/local/bin/oraenv ];then . /usr/local/bin/oraenv fi ORAENV_ASK=YES export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/libFinally a more sophisticated script to create a database in /var/oradata ( for example ) : ( as oracle ) #!/bin/bash # --------------------------------------------------------------------------- # file : createdb1.sql # --------------------------------------------------------------------------- DB=db1 DBPATH=/var/oradata ORACLE_SID=$DB mkinit() { export ORACLE_SID=$DB export ORAENV_ASK=NO . /usr/local/bin/oraenv cp init$DB.ora $ORACLE_HOME/dbs } mkdb() { sqlplus /nolog <> $ORACLE_HOME/dbs/init$DB.ora
}

resp=n
echo -n "Create initial files ?"
read resp
case $resp in
y) echo "Creating initialization files"
mkinit
;;
esac


resp=n
echo -n "Create database ?"
read resp
case $resp in
y) echo "Creating $DB"
mkdb
;;
esac


resp=n
echo -n "Run database scripts ?"
read resp
case $resp in
y) echo "Running scripts for $DB"
scdb
;;
esac


resp=n
echo -n "Create tablespaces ?"
read resp
case $resp in
y) echo "Creating tablespaces for $DB"
mktb
;;
esac


resp=n
echo -n "Create objects ?"
read resp
case $resp in
y) echo "Creating some objects for $DB"
mkoj
;;
esac

Help
Oracle Technology Network is a good source of help and documentation

17 comments:

逆円助 said...

さあ、今夏も新たな出会いを経験してみませんか?当サイトは円助交際の逆、つまり女性が男性を円助する『逆円助交際』を提供します。逆円交際を未経験の方でも気軽に遊べる大人のマッチングシステムです。年齢上限・容姿・経験一切問いません。男性の方は無料で登録して頂けます。貴方も新たな出会いを経験してみませんか

精神年齢 said...

みんなの精神年齢を測定できる、メンタル年齢チェッカーで秘められた年齢がズバリわかっちゃう!かわいいあの子も実は精神年齢オバサンということも…合コンや話のネタに一度チャレンジしてみよう

メル友募集 said...

最近仕事ばかりで毎日退屈してます。そろそろ恋人欲しいです☆もう夏だし海とか行きたいな♪ k.c.0720@docomo.ne.jp 連絡待ってるよ☆

家出 said...

最近TVや雑誌で紹介されている家出掲示板では、全国各地のネットカフェ等を泊り歩いている家出娘のメッセージが多数書き込みされています。彼女たちはお金がないので掲示板で知り合った男性の家にでもすぐに泊まりに行くようです。あなたも書き込みに返事を返してみませんか

動物占い said...

あなたの性格を、動物に例えて占っちゃいます。もしかしたらこんな動物かも!?動物占いをうまく使って、楽しい人間関係を築いてください

家出 said...

家出中の女性や泊まる所が無い女性達がネットカフェなどで、飲み放題のドリンクで空腹を満たす生活を送っています。当サイトはそんな女性達をサポートしたいという人たちと困っている女性たちの為のサイトです

セレブラブ said...

セレブ女性との割り切りお付き合いで大金を稼いでみませんか?女性に癒しと快楽、男性に謝礼とお互い満たしあえる当サイト、セレブラブはあなたの登録をお待ちしております。

夏フェス!! said...

夏フェス一緒に行ってくれる人募集!!夏の思い出一緒につくろぉ☆ megumi-0830@docomo.ne.jp 連絡してね♪

無料ゲーム said...

あなたのゲーマー度を無料ゲーム感覚で測定します。15個の質問に答えるだけの簡単測定で一度遊んでみませんか?ゲームが得意な人もそうでない人もぜひどうぞ。

素人 said...

Hな女性たちは素人ホストを自宅やホテルに呼び、ひとときの癒しを求めていらっしゃいます。当サイトでは男性ホスト様の人員が不足しており、一日3~4人の女性の相手をするホストもおられます。興味を持たれた方は当サイトにぜひお越しください

出会い系 said...

実は出会い系には…関係者用入り口があるのを知っていますか?広告主やスポンサー用に用意されたIDではサクラや業者が立ち入ることが出来ないようになっているのです。当サイトでは極秘に入手した関係者用URLが公開されています

逆援助 said...

男性はお金、女性は快楽を得る逆援助に興味はありませんか?お金を払っても性的欲求を満たしたいセレブ達との割り切り1日のお付き合いで当サイトでは大金を得ることができます。無料登録なのでアルバイト感覚でOK、詳しくはTOPページでどうぞ。

友達募集 said...

ホムペ完成記念!私の事みんなに知ってもらいたくて頑張りましたぁ。色々とご感想をお待ちしているので思った事を意見してください。メアドはほむぺにのせてありますぅ!★ fan.jna@docomo.ne.jp

家出 said...

夏休みで気軽に家出する女子○生が急増しています。しかし家出したはいいものの泊る所やお金が無い彼女たちは、掲示板などで泊めてくれる男性を探す子も多いようです。当掲示板にも夏休みに入ってから通常の3倍以上のメッセージが寄せられています

人妻 said...

今最もアツイバイトは人妻とのセフレ契約です。当サイトではお金を払ってでもセフレがほしい人妻が集まり、男性会員様との逆援生活を待っています。当サイトで欲求不満の女性との出会いをしてみませんか

素人 said...

素人ホストでは、男性のテクニック次第で女性会員様から高額な謝礼がもらえます。欲求不満な人妻や、男性と出会いが無い女性達が当サイトで男性を求めていらっしゃいます。興味のある方はTOPページからどうぞ

友達募集中 said...

少し魅惑な自分をネットだから公開してみました。普段言えない事など、思い切って告白しているプロフなので興味ある方はぜひ除いてみてください連絡待ってまぁす。 hinyaaaaa@docomo.ne.jp