LDP/LDP/howto/docbook/Oracle-9i-Fedora-3-Install-...

414 lines
17 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<article id="Oracle-9i-Fedora-3-Install-HOWTO">
<articleinfo>
<title>Oracle 9i under Fedora Core 3 - Installation HOWTO</title>
<author>
<firstname>Gaurav</firstname>
<surname>Prasad</surname>
<affiliation>
<address>
<email>gauravpd at gmail dot com</email>
</address>
</affiliation>
</author>
<pubdate>2005-06-27</pubdate>
<revhistory id="revhistory">
<revision>
<revnumber>v1.0</revnumber>
<date>2005-06-22</date>
<authorinitials>MG</authorinitials>
<revremark>For inclusion in TLDP: Completed XML article structure with articleinfo, section IDs for cross-referencing; technical, language, grammar and spelling review.</revremark>
</revision>
<revision>
<revnumber>v1.0-pre1</revnumber>
<date>2005-04-01</date>
<authorinitials>GP</authorinitials>
<revremark>Added miscellaneous errors section.</revremark>
</revision>
<revision>
<revnumber>v0.1</revnumber>
<date>2005-03-25</date>
<revremark>First publication.</revremark>
</revision>
</revhistory>
<abstract>
<para>This tutorial describes how to install Oracle 9i on Fedora Core 3 or greater.</para>
</abstract>
</articleinfo>
<sect1 id="sect_01">
<title>1. Introduction</title>
<sect2 id="sect_01_01"><title>What you need to know</title>
<para>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.</para>
<para>I hope you will find this short tutorial useful.</para>
<para>If you need to install Oracle 9i on FC3, you should be aware of the following facts:</para>
<orderedlist>
<listitem>
<para>Fedora is not *Officially Supported* by Oracle Corp.</para>
</listitem>
<listitem>
<para>Oracle 9i installation is difficult but possible on FC3.</para>
</listitem>
<listitem>
<para>Oracle 9i CANNOT be linked with the libraries used by gcc 3.4. On FC3 you need to use the FC2 GCC compat libraries.</para>
</listitem>
<listitem>
<para>The Oracle 10 G installation method does NOT WORKS with 9i.</para>
</listitem>
<listitem>
<para>This HOWTO deals with RedHat products &gt;= 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 <ulink url="http://www.puschitz.com/OracleOnLinux.shtml">http://www.puschitz.com/OracleOnLinux.shtml</ulink> and <ulink url="http://oracle-base.com/">http://oracle-base.com/</ulink>.</para>
</listitem>
</orderedlist>
<para>Also keep in mind: </para>
<orderedlist>
<listitem>
<para>This HOWTO aims only to assist you. This is not an OFFICIAL Oracle document.</para>
</listitem>
<listitem>
<para>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.</para>
</listitem>
<listitem>
<para>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.</para>
</listitem>
</orderedlist>
</sect2>
<sect2 id="sect_01_02"><title>Acknowledgments</title>
<para>I would like to thank Jean Fran&#231;ois for helping me out with the most
tricky parts.</para>
</sect2>
<sect2 id="sect_01_03"><title>Availability and Feedback</title>
<para>The latest version can be found at <ulink url="http://www.pagux.com/oracle9ionfedora3.html" />.</para>
<para>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.</para>
</sect2>
<sect2 id="sect_01_04"><title>Licensing Information and Liability</title>
<para>Copyright 2005 Gaurav Prasad</para>
<para>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 <ulink url="http://www.gnu.org/copyleft/fdl.html" />.</para>
<para>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.
</para>
<para>Linux is a registered trademark of Linus Torvalds.</para>
<para>
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.
</para>
</sect2>
</sect1>
<sect1 id="sect_02"><title>Get Oracle 9i</title>
<sect2 id="sect_02_01"><title>CD Installation</title>
<para>If you got Oracle 9i on a CD then mount it:</para>
<cmdsynopsis><command>mount <option>-r -o loop=/dev/loop0</option> <filename>ora9id1.iso Disk1/</filename></command></cmdsynopsis>
</sect2>
<sect2 id="sect_02_02"><title>Download</title>
<para>Otherwise download it from <ulink url="http://www.oracle.com/technology/software/products/oracle9i/htdocs/linuxsoft.html" />.</para>
</sect2>
<sect2 id="sect_02_03"><title>Install</title>
<para>Extract all three files:</para>
<cmdsynopsis><command>gunzip <filename>ship_9204_linux_disk1.cpio.gz</filename></command></cmdsynopsis>
<cmdsynopsis><command>cpio <option>-idmv -I</option> <filename>ship_9204_linux_disk1.cpio</filename></command></cmdsynopsis>
<para>Don't forget the <option>-I</option> option or you will get errors during the extraction.</para>
<para>This command will expand the cpio archive to the <filename>Disk1</filename> directory. Repeat the process for the other two archives.</para>
</sect2>
</sect1>
<sect1 id="sect_03"><title>Prepare for Configuration</title>
<sect2 id="sect_03_01"><title>Create Users and Groups</title>
<para>Execute the following commands as <emphasis>root</emphasis>:</para>
<screen>
# groupadd oinstall
# groupadd dba
# groupadd oper
# groupadd apache
# useradd -g oinstall -G dba oracle
# passwd oracle
</screen>
<para>Set the password for user <emphasis>oracle</emphasis>.</para>
</sect2>
<sect2 id="sect_03_02"><title>Create Directories</title>
<para>The final destination of the software will be here:</para>
<screen>
# mkdir /u01 /u02
# chown oracle.dba /u01 /u02
# chmod 755 /u01 /u02
</screen>
</sect2>
</sect1>
<sect1 id="sect_04"><title>Set Environment Variables</title>
<para>Log in as the <emphasis>oracle</emphasis> user:</para>
<cmdsynopsis><command>su <option>-</option> <parameter>oracle</parameter></command></cmdsynopsis>
<para>Edit <filename>.bash_profile</filename> in <emphasis>oracle</emphasis>'s home directory and add the following, for instance using <command>vim</command>:</para>
<screen>
########## 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 ##########
</screen>
</sect1>
<sect1 id="sect_05"><title>Set Kernel Parameters</title>
<sect2 id="sect_05_01"><title>Edit /etc/sysctl.conf</title>
<para>Add the following lines to the <filename>/etc/sysctl.conf</filename> file:</para>
<screen>
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
</screen>
</sect2>
<sect2 id="sect_05_02"><title>Edit /etc/security/limits.conf</title>
<para>Additionally the following lines can be added to the <filename>/etc/security/limits.conf</filename> file:
</para>
<screen>
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
</screen>
<para>Adding lines into these files requires a reboot before the new settings
take effect.</para>
</sect2>
</sect1>
<sect1 id="sect_06"><title>Install GCC 2.9 Compat libraries</title>
<sect2 id="sect_06_01"><title>Install GCC 2.96 Compat packages</title>
<para>From Fedora Core TWO:</para>
<itemizedlist>
<listitem><para><filename>compat-libstdc++-7.3-2.96.126.i386.rpm</filename></para></listitem>
<listitem><para><filename>compat-libstdc++-devel-7.3-2.96.126.i386.rpm</filename></para></listitem>
<listitem><para><filename>compat-gcc-7.3-2.96.126.i386.rpm</filename></para></listitem>
<listitem><para><filename>compat-gcc-c++-7.3-2.96.126.i386.rpm</filename></para></listitem>
</itemizedlist>
<caution><title>Don't overwrite existing packages</title>
<para>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 <command>rpm <option>-i --force</option></command> to install the older ones next to the newer ones.</para>
</caution>
<para>From the Fedora Core THREE subtree, get the <application>compat-db</application> package.</para>
<para>If you don't install GCC compat libraries as above you get
a zillion linking errors.</para>
</sect2>
<sect2 id="sect_06_02"><title>Create symbolic links</title>
<para>Put gcc296 and g++296 first in
your $PATH variable by creating the following symbolic links:</para>
<screen>
# 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++
</screen>
<para>Note that should you already have upgraded your system, GCC versions might be different.</para>
</sect2>
</sect1>
<sect1 id="sect_07"><title>Run Installer</title>
<sect2 id="sect_07_01"><title>Apply the libwait.c patch</title>
<para>Before running the installer, do the following in order to overcome some weird errors:</para>
<itemizedlist>
<listitem><para>In <filename>/home/oracle</filename>,create a file name <filename>libwait.c</filename> and as described below and compile it :</para>
<screen>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
</screen>
<cmdsynopsis><command>gcc <option>-shared -o</option> <filename>libcwait.so libcwait.c</filename> <option>-fpic -O</option></command></cmdsynopsis>
</listitem>
<listitem><para>Then add this library to the environment of the database user:</para>
<cmdsynopsis><command>export <varname>LD_PRELOAD</varname>=<filename>/home/oracle/libcwait.so</filename></command></cmdsynopsis>
<para>Earlier, we put a similar line in <filename>.bash_profile</filename>.</para>
</listitem>
</itemizedlist>
</sect2>
<sect2 id="sect_07_02"><title>Configure the Display</title>
<para>Execute the following commands as oracle User :</para>
<screen>
oracle@9iserver ~&gt; xhost +localhost
oracle@9iserver ~&gt; export DISPLAY=localhost:0.0
</screen>
<para>You can now connect to your desktop or optionally run the installation remotely, for instance using <application>VNC</application>.for instance running the installer from your Windows desktop
</para>
</sect2>
<sect2 id="sect_07_03"><title>Start the Installation</title>
<para>Start the graphical installation application:</para>
<cmdsynopsis><command>/path/to/oracle/Disk1/runInstaller</command></cmdsynopsis>
<para>Now carry with Graphical setup (if you are not sure choose Standard database). From here the rest of the installation process is obvious.</para>
</sect2>
<sect2 id="sect_07_04"><title>Fix nodeinfo</title>
<para>Now installation should proceed without any linking errors but you will get one error in the end:</para>
<screen>
Parameter "nodeinfo" = NO_VALUE
Agent Service Failed
</screen>
<para>In order to fix this, run the following for starting the wizard after setup has finished:</para>
<cmdsynopsis><command>netca &amp;</command></cmdsynopsis>
<para>Now change into <varname>$ORACLE_HOME</varname> and run <command>./lsnrctl <parameter>start</parameter></command>.</para>
<para>Check that the process is running:</para>
<cmdsynopsis><command>ps <option>afx</option> | grep <parameter>LISTEN</parameter></command></cmdsynopsis>
</sect2>
</sect1>
<sect1 id="sect_08"><title>Create a Startup Script</title>
<para>In order for the Oracle server to start automatically at system boot time, create the file <filename>/etc/init.d/oracle</filename> like this:</para>
<screen>
#!/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
</screen>
<para>Now run <command>chkconfig <filename>oracle</filename></command> for updating the run level information.</para>
<para>Try <command>service <parameter>oracle start|stop|restart</parameter></command> to check that everything works as expected now.</para>
<para>If you reached this step without errors: congratulations. Else, check <xref linkend="sect_09" /> for troubleshooting suggestions.</para>
</sect1>
<sect1 id="sect_09"><title>Miscellaneous Errors</title>
<para>ERROR:</para>
<screen>
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory
</screen>
<para>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.</para>
<para>Solution:</para>
<orderedlist>
<listitem><para>Check <filename>/etc/oratab</filename> and make sure that <option>*:/opt/oracle/OraHome1</option> and <option>ordb:/opt/oracle/OraHome1</option> are set to <quote>Y</quote> (YES).</para></listitem>
<listitem><para>Try to initialize the database: <command>$ORACLE_HOME/bin/dbstart</command>.</para></listitem>
</orderedlist>
<para>ERROR:</para>
<screen>
No start entry for SID * at /opt/oracle/OraHome1 in /etc/oratab
</screen>
<para>This might be caused by a bug in the dbstart script which searches for the sid file in the wrong place.</para>
<para>Solution:</para>
<orderedlist>
<listitem><para><command>cp <filename>$ORACLE_BASE/admin/$ORACLE_SID/pfile/init_*.ora</filename></command> \</para>
<para><filename>$ORACLE_HOME/dbs/init$ORACLE_SID.ora</filename></para>
</listitem>
<listitem><para>As user <emphasis>oracle</emphasis>:</para>
<screen>
$ sqlplus
SQL&gt; create pfile from spfile;
SQL&gt; exit
</screen>
</listitem>
<listitem><para>Run the <filename>dbstart</filename> script: <command>$ORACLE_HOME/bin/dbstart</command>.</para></listitem>
</orderedlist>
</sect1>
</article>