|
by Mark Kirkwood
(July 29th, 2001)
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 :
There are three big files :
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.
# 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...)
$ 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... )
$ 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 <<! connect / as sysdba startup nomount create database db1; !This creates a default database with files in $ORACLE_HOME/dbs
Now add the database meta data to actually make it useful :
$ sqlplus /nolog <<! connect / as sysdba @?/rdbms/admin/catalog @?/rdbms/admin/catproc !Now create a user and give it wide ranging permissions :
$ sqlplus /nolog <<! connect / as sysdba create user myuser identified by password; grant create session,create any table to myuser; grant unlimited tablespace to myuser; !Now the usual sort of database stuff can be done :
$ sqlplus myuser/password <<! create table mytable(id integer, val varchar2(100)); insert into mytables values(1,'xxxxx'); select * from mytable; !You can shut down the database with :
$ sqlplus /nolog <<! connect / as sysdba shutdown !And start it again with :
$ sqlplus /nolog <<! connect / as sysdba startup !Simple command line versions of these are provided :
$ dbshut $ dbstartThe thing that is unusual about Oracle is that there is a one to one correspondence between database server (ORACLE_SID) and database (db_name in init$ORACLE_SID.ora) - i.e : one server manages one and only one database. Compare this to Mysql or Postgresql where one server manages many databases. If you want another database, then you must go through the above steps again with ORACLE_SID set differently and a new initialization file with a new db_name in it.
$ echo " LISTENER = (ADDRESS_LIST= (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)) (ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))" > $ORACLE_HOME/network/admin/listener.ora $ lnsrctl start $ echo "DB1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = < your 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]
#!/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 <<! connect / as sysdba startup ! su -l oracle -c "lsnrctl start > /dev/null" ;; stop) # Stop server. $ECHO_N "Stopping Oracle: "$ECHO_C su -l oracle -c sqlplus /nolog > /dev/null <<! connect / as sysdba shutdown abort ! su -l oracle -c "lsnrctl stop > /dev/null" ;; *) echo $"Usage: $0 {start|stop}" 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 <<! CONNECT / AS SYSDBA STARTUP NOMOUNT CREATE DATABASE $DB DATAFILE '$DBPATH/$DB/sys.dat' SIZE 200M AUTOEXTEND ON NEXT 10M LOGFILE GROUP 1 '$DBPATH/$DB/log01.dat' SIZE 50M, GROUP 2 '$DBPATH/$DB/log02.dat' SIZE 50M ; ! } scdb() { sqlplus /nolog <<! CONNECT / AS SYSDBA @?/rdbms/admin/catalog @?/rdbms/admin/catproc ! } mktb() { sqlplus /nolog <<! CONNECT / AS SYSDBA CREATE TABLESPACE rollback DATAFILE '$DBPATH/$DB/rollback.dat' SIZE 100M AUTOEXTEND ON NEXT 100M DEFAULT STORAGE ( INITIAL 10M NEXT 10M PCTINCREASE 0) ; CREATE TABLESPACE temp DATAFILE '$DBPATH/$DB/temp.dat' SIZE 100M AUTOEXTEND ON NEXT 100M DEFAULT STORAGE ( INITIAL 10M NEXT 10M PCTINCREASE 0) TEMPORARY ; CREATE TABLESPACE data DATAFILE '$DBPATH/$DB/data.dat' SIZE 200M AUTOEXTEND ON NEXT 100M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ; ! } mkoj() { sqlplus /nolog <<! CONNECT / AS SYSDBA CREATE ROLLBACK SEGMENt t0 ; ALTER ROLLBACK SEGMENT t0 ONLINE; SET TRANSACTION USE ROLLBACK SEGMENT t0; CREATE ROLLBACK SEGMENT r0 TABLESPACE rollback; CREATE ROLLBACK SEGMENT r1 TABLESPACE rollback; ALTER ROLLBACK SEGMENT t0 OFFLINE; DROP ROLLBACK SEGMENT t0; ! echo "rollback_segments = (r0,r1)" >> $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
Reader's Comments - Add Comment | Add an Email Alert
Good guide for installing oracle on Linux. I faced lot of problems before reading this doc. But now it has become very easy to install oracle on Linux 7.0
-- Krishna Kari (Dec 5, 2001 01:49:01)
I wish I had read your guide before I installed Oracle on my RH 7.1 box. I found the same information out that you listed above, but only after reading a dozen or so other sources. GOOD WORK!
-- Mark Armstrong (Dec 11, 2001 16:20:50)
Excellent guide - terse and well written.
I installed 9i on Linux Redhat 7.2 - the standard distribution comes with a higher
version of binutils which causes link problems. Here are the versions on my machine
when 9i finally installed successfully :
kernel 2.4.7-10
glibc 2.2.4-13
binutils 2.10.0.18-1 (this package differs from the standard distribution)
Thanks
Satya
-- prakashj (Dec 22, 2001 14:22:56)
Thanks for building this page. Made the whole install process alot
easier on Redhat 7.0. Sure beats trying to decipher the Oracle 9i documentation. Thanks again!
-- Neal Sphere (Jan 12, 2002 17:46:35)
one thing that really tripped me up was the cpio step, it just set there like grep without a file to search through.
you actually need to pass it the file (redirect it) like this:
cpio -idmv < Linux9i_Disk1.cpio.gz
hopefully that will save someone a few headaches :)
-- Jeff Schoolcraft (Jan 14, 2002 09:46:18)
Thanks Mark for a great article. To follow on from what prakashj said on Dec 22, 2001, there is a less intrusive method for linking 9.0 on 7.2 RedHat. It is detailed here http://www.ibiblio.org/pub/Linux/kernel.org/pub/linux/devel/binutils/binutils-2.10.91.0.4-1.i386.rpm
Cheers.
-- Ed Hagerty (Jan 25, 2002 19:47:28)
This article is eventually neat!
Does anyone try with oracle9i, running in php4.1.1 and Apache?
-- Louis Lee (Jan 29, 2002 06:09:28)
sir,
Good Guide.But i am install Oracle
9i Application Server in red hat
linux 7.2.so,plz sent the books and
website address.
Awaiting for ur Reply.
Keep in touch.
Anybody Sent the Books
myemail:rjpmkumar@rediffmail.com
withregards,
K.Kumar.
-- kumar k (Feb 18, 2002 02:01:57)
how do you test to see which binutils is installed, I am using Mandrake but want to convert to redhat, I am also using a Pentium 4,
which has some problems installing oracle in a windows environment.
You have to remove a file as well as update the java plug. Any ideas
about the above, thanks. Susan
-- Susan Hall (Mar 10, 2002 10:38:50)