|
|
Installing Oracle 9i R2 on Linux
This document will cover the basic steps necessary to get
Oracle
9i Release 2 installed successfully on Linux. It is assumed
that the version of Linux being used is Red Hat Linux 7.3 or
8.0. Most of what this document suggests is applicable to other
Linux distributions and releases, but details may vary slightly
with other Linuxen.
These instructions will not work for installing Oracle
on the upcoming Red Hat Linux 8.1 release. New Linux releases, such
as Red Hat Linux 8.1, use a new threading model which is
incompatible with the threading model assumed by the two JVMs
embedded in Oracle 9i R2. A new release of Oracle will be necessary
for these systems which use the Native POSIX
Threads Library.
Modification of the Oracle executable scripts to use
NPTL-compliant Java implementations instead of the Java
implementations bundled with Oracle can be done on these systems to
obtain a partially functional Oracle install, but this approach is
not recommended; some of the Oracle executables function correctly
only under the Java implementations which are included with Oracle.
For full functionality, use of Red Hat 8.0 or older Linux
distributions is recommended until Oracle releases a new version
which supports NPTL.
The basic steps necessary to get an Oracle instance up and
running on Linux are to
|
| Installing Red Hat Linux is amply documented
elsewhere, and will not be covered here again. There are a
couple of requirements to keep in mind when installing a Linux
server for deployment of Oracle, however. The Oracle installation
program is a graphical, X-based application, so X libraries will
need to be installed on the Linux server. Similarly, during
installation the Oracle installer actually links the various Oracle
libraries and executable files. For this to succeed, basic
development tools will need to be installed on the Linux machine.
In addition, if access to the Oracle database via a network
connection will be necessary, be certain during the Linux
installation not to configure a firewall which will block access to
TCP port 1521 (the default port used by Oracle's Listener
service). |
As with installation, configuration of Red Hat Linux is
well-documented. Key configuration steps to keep in mind are
- disabling all unneeded services
- installing all system errata
Both of these steps are part of a proper security routine,
protecting the data stored in the Oracle database from unwanted
accesses. |
After installing and configuring Linux, Java will need to be
installed on the Linux server. Because of Sun's licensing
constraints, most Linux vendors (including Red Hat) cannot ship
with a functional JVM. The Oracle Installer and many other Oracle
tools (such as the Oracle Enterprise Manager) are Java-based, and
require a JVM to function.
Three different Java implementations are widely used on Linux
systems. JDKs are available from
At least version 1.3 (Java 2) of these JDKs will need to be
installed to run the Oracle 9i Installer; Sun's Java 2 SDK (1.4.1)
works well and is an appropriate choice for most uses. |
Several configuration and system files are needed to install
and run Oracle on Linux systems. These files are supplied by
Guru Labs as either an
easily installed RPM file or as a compressed tarball, available
from
The RPM should be downloaded and installed on the Linux system by
carrying out, as root, the commands
# cd /var/tmp
# wget http://www.gurulabs.com/files/oraclerun9i-1.4-1.noarch.rpm
# rpm -Uvh /var/tmp/oraclerun9i-1.4-1.noarch.rpm
This RPM installs several files on the system:
- /etc/init.d/oracle
- /etc/profile.d/oracle.csh
- /etc/profile.d/oracle.sh
- /etc/sysconfig/oracle
/etc/init.d/oracle is a System V style initialization script
which allows Oracle to be started or stopped easily. It integrates
fully with all Red Hat system management tools (ntsysv, chkconfig,
etc.).
/etc/profile.d/oracle.csh is a system-wide initialization
file to set Oracle-specific environmental variables for users of C
shell (and C shell derivatives), while
/etc/profile.d/oracle.sh is a system-wide initialization
file to set Oracle-specific environmental variables for users of
the Bourne shell (and Bourne shell derivatives).
/etc/sysconfig/oracle is an Oracle configuration file. It
contains both run-time options which will be applied to Oracle upon
startup, as well as Linux kernel tuning parameters which modify
necessary Linux kernel options to support Oracle.
After the oraclerun9i RPM is installed, some of the
configuration files it creates must be edited to configure Oracle
as appropriate for the local system. Both
/etc/profile.d/oracle.sh and
/etc/profile.d/oracle.csh must be edited as root, and the
lines configuring ORACLE_HOME and ORACLE_SID must be uncommented
and set to the values of ORACLE_HOME and ORACLE_SID which will be
used on this system.
For /etc/profile.d/oracle.sh, lines 7 and 8 should be
changed to
ORACLE_HOME=/opt/oracle
ORACLE_SID=ora1
while for /etc/profile.d/oracle.csh, lines 7 and 8 should be
changed to
setenv ORACLE_HOME /opt/oracle
setenv ORACLE_SID ora1
or whatever values of ORACLE_HOME and ORACLE_SID you prefer;
ORACLE_HOME should be set to the directory in which you intend to
install Oracle, while ORACLE_SID should be set to the SID (System
ID) which you intend to assign to this instance of Oracle.
In addition, the directory which will be used as ORACLE_HOME
needs to be created. As root, the command
# mkdir /opt/oracle
will get things ready.
This assumes that ORACLE_HOME will be set to /opt/oracle. If
Oracle is being installed to a different directory, these commands
will need to be adjusted accordingly.
While editing /etc/profile.d/oracle.sh and
/etc/profile.d/oracle.csh, also check out line 11, which
modifies the user PATH variable to include the location of the
system's JVM. This will currently specify the correct PATH for
Sun's 1.4.1 Java 2 SDK; if using a different JVM, this line should
be adjusted accordingly.
In addition, you might also want to edit
/etc/sysconfig/oracle. In particular, line 5 will almost
definitely need to be changed to
START_ORACLE="yes"
to enable Oracle server functionality.
/etc/sysconfig/oracle also sets various kernel tuning
parameters, such as the maximum shared memory segment size. Default
Linux kernel parameters are optimized for interactive usage, and
must be increased for the memory usage patterns exhibited by
Oracle. The default supplied values in /etc/sysconfig/oracle
will tune the system to run a typical database, but might need to
be tuned more for larger databases. See Oracle's documentation for
more discussion of appropriate values for kernel
parameters.
Before installation can be started, the kernel parameters
defined in /etc/sysconfig/oracle must be applied to the
running system; in the future, these values will be automatically
set at boot time by /etc/init.d/oracle, the Oracle System V
init script. To tune the currently running Linux kernel
appropriately for Oracle installation, run as root the command
# service oracle tunekernel
This command can also be run after installation; it simply reads
/etc/sysconfig/oracle and applies all kernel parameters in
the file to the currently running kernel, making kernel performance
tuning as simple as editing /etc/sysconfig/oracle and
running a command. |
Once the Linux kernel has been tuned for Oracle and various
configuration and initialization scripts have been installed,
system accounts need to be created on the system for use by Oracle.
As root, running the commands
# groupadd dba ; groupadd oper ; groupadd oinstall ; groupadd oraweb
# useradd -g oinstall -G dba oracle
# useradd -g oinstall -G oraweb orahttp
will create four system groups (dba,oper,
oraweb, and oinstall) and two users (oracle, a
member of the dba and oinstall groups, and
orahttp, a member of the oraweb and oinstall
groups). After accounts have been created, directories need to be
created with appropriate permissions and ownerships for use by
Oracle. Running, as root, the commands
# chown oracle:oinstall /opt/oracle
# mkdir /var/opt/oracle
# chown oracle:dba /var/opt/oracle
will create these directories and set appropriate ownership on
them. |
After creating these users and directories, the system is
finally configured for Oracle installation. The Oracle installation
files now need to be put on the system. Oracle for Linux is
available from two different sources:
If downloaded, the Oracle Installer will be provided as three
approximately 500 megabyte gzipped CPIO files. These three files
should be downloaded to an appropriate temporary directory, such as
/tmp. As root, the commands
# cd /tmp
# for i in 1 2 3 ; do gunzip Linux9i_Disk$i.cpio.gz ; done
will uncompress the downloaded files.
If obtained on CD-ROM, the Oracle Installer will be provided as
three uncompressed CPIO files. These three files should be copied
to an appropriate temporary directory, such as /tmp.
Once the Oracle Installer files are on the system, they need to
be unpacked to a temporary directory on the system. /orainst
is typically created and used for this purpose. As root, the
commands
# mkdir /orainst
# chown oracle /orainst
# su - oracle
$ cd /orainst
$ for i in 1 2 3 ; do cpio -idm < /tmp/Linux9i_Disk$i.cpio ; done
$ chmod -R u=rwx,g=rwx .
will create the /orainst directory, unarchive the Oracle
Installer into that directory, and set appropriate permissions on
the Oracle Installer files.
If using a different temporary installation source directory,
adjust the above commands as appropriate.
Once the Oracle Installer has been unarchived, installation can
begin. As the oracle user, first double-check that all necessary
ORACLE_* variables are set; this can be done by making sure that a
command such as
$ env | grep ORACLE
returns results. If variables are not set, the command
$ . /etc/profile.d/oracle.sh
should set all necessary variables.
Once all variables are set, the Oracle Installer should be
started. As the oracle user, run the command
$ /orainst/Disk1/runInstaller
While the installer starts up, bring up a second terminal and make
sure you are logged in as root on that terminal; this terminal will
be needed during the installation.
After a moment or two, the Oracle Installer will pop up.
|

|
Click "Next" to move on to the next screen.
The Oracle Installer will first ask for a base directory
location. By default, it will assume Oracle should be installed to
$HOME. Change the base directory to $ORACLE_HOME/oraInventory. For
example, if ORACLE_HOME is set to /opt/oracle, then enter
/opt/oracle/oraInventory as the base directory.
|
Then click "OK" to move on to the next screen.
The Oracle Installer will next ask for the name of a UNIX Group
which should have permission to access the Oracle software directly
on the system. oinstall should be entered as the name of the
group.
|
Then click "OK" to move on to the next screen.
Next, you will see a dialog box asking you to run, as root, a
shell script.
|
In the second shell you started (as root), run the stated
command
# /tmp/orainstRoot.sh
When it finishes, click "Continue" in the dialog box to
proceed.
Oracle's Installer will next ask you to confirm the locations of
various files on the system. Typically, the default values
suggested by the installer will be fine.
|
Click "Next" to accept the defaults and move on to the next
screen.
You will next be asked which Oracle product you wish to
install.
|
Typically, the Oracle9i Database is what you want. Click "Next"
to continue.
Now you will be asked which type of Oracle9i Database
installation (Standard or Enterprise) you would like.
|
Usually the Enterprise Edition is fine. Make sure it is
selected, then click "Next" to continue.
As part of the Oracle9i Database installation, the Oracle
Installer creates a database for you. Most of the time, a "General
Purpose" database is fine, but the installer can create other
database configurations if needed.
|
Select an appropriate database type, then click "Next" to
continue.
Oracle's Installer will next ask for database identification
information. Fill in an appropriate Global Database Name, and make
sure that the SID value is the same value you have set in your
ORACLE_SID variable.
|
Click "Next" to continue.
You will next be asked where database files should be installed
on the system. Keep in mind the performance benefits which can be
gained by careful configuration of the locations of database files,
and select an appropriate location for the database.
|
After choosing a database location, click "Next" to
continue.
Next, the Oracle installer will ask which character set should
be used for the database. Typically, either the default character
set or Unicode should be chosen.
|
After selecting an appropriate character set, click "Next" to
continue.
A summary of all your configuration choices will now be
displayed. Double- check it to make sure all settings are correct,
then click "Install".
Before you click "Install", be prepared. Several work-arounds
(typically edits of installation scripts) will be necessary during
the install, and some of these work-arounds are timing-dependent.
Make sure you have a terminal handy in which you are logged in as
root so that you can make these edits when necessary.
|
|
Once you click "Install", an installation progress dialog will
appear. Pay close attention to the Progress meter; your first
work-around needs to be executed when the install is approximately
12% complete.
|

|
|
After the installation is 12% completed, bring up the root
terminal. You will need to edit line 198 in the file
/opt/oracle/bin/genclntsh, which can easily be done using
the vi command
# vi +198 /opt/oracle/bin/genclntsh
Line 198 will currently look like:
${LD} ${LD_RUNTIME} ${STUBS} ${LD_OPT} ${LD_OUT} ${LD_SELF_CONTAINED} \
The ${LD_SELF_CONTAINED} statement needs to be removed from this
line in order for the Linux linker to link Oracle correctly. Delete
that statement, so that line 198 instead reads:
${LD} ${LD_RUNTIME} ${STUBS} ${LD_OPT} ${LD_OUT} \
save the file, and exit.
Remember, this modification is timing-sensitive. It must be done
after roughly 12% of the install is finished, but needs to be done
quickly at that point. If you do not complete this modification in
time, the installer will crash later in the install and will not be
recoverable. If that happens, you will need to delete
/etc/oratab, remove all files under /opt/oracle, and
start the install over....
Once this edit is made, continue watching the installation.
After basic installation (copying of all files into place) is
finished, the Oracle Installer will being linking the Oracle
programs together. After linkage is 84% complete, an error dialog
box will appear on the screen and the installation will
stop:
|

|
| To fix this error, edit line 1365 in the file
/opt/oracle/ctx/lib/env_ctx.mk. This can be done by the vi
command |
# vi +1365 /opt/oracle/ctx/lib/env_ctx.mk
in the terminal in which you are root.
Line 1365 in this file will currently look like
|
INSO_LINK = -L$(CTXLIB) $(LDLIBFLAG)m $(LDLIBFLAG)sc_ca
$(LDLIBFLAG)sc_fa $(LDLIBFLAG)sc_ex $(LDLIBFLAG)sc_da
$(LDLIBFLAG)sc_ut $(LDLIBFLAG)sc_ch $(LDLIBFLAG)sc_fi $(LLIBCTXHX)
$(LDLIBFLAG)c -Wl,-rpath,$(CTXHOME)lib $(CORELIBS)
$(COMPEOBJS) |
Modify this line by adding $(LDLIBFLAG)dl to the end of
it, so that it instead reads
INSO_LINK = -L$(CTXLIB) $(LDLIBFLAG)m $(LDLIBFLAG)sc_ca
$(LDLIBFLAG)sc_fa $(LDLIBFLAG)sc_ex $(LDLIBFLAG)sc_da
$(LDLIBFLAG)sc_ut $(LDLIBFLAG)sc_ch $(LDLIBFLAG)sc_fi $(LLIBCTXHX)
$(LDLIBFLAG)c -Wl,-rpath,$(CTXHOME)lib $(CORELIBS) $(COMPEOBJS)
$(LDLIBFLAG)dl
|
Save the file, then click "Retry" in the Oracle installer.
Installation will now be able to proceed....
You will next be asked by the installer to run, as root, a shell
script:
|

|
|
In the shell where you are logged in as root, run the
command
# /opt/oracle/root.sh
Once this script finishes (which will take a bit; amongst other
things, it sets ownerships and permissions on all the thousands of
Oracle files), click "OK" so installation can proceed.
The Oracle installer will next run a variety of post-install
configuration tools, start the Oracle server processes, create an
initial database, and carry out other general database
configurations.
|

|
|
Sometimes, the Database Configuration Assistant will fail at
this point. If it does, the problem is typically due to Linux
kernel shared memory segment size limitations. Earlier, you tuned
your kernel for Oracle operation (by running the command service
oracle tunekernel), but the installation and creation of the
initial database sometimes requires different amounts of shared
memory than are needed for operation. You can change the shared
memory segment size limitations on the fly by running, in the
terminal where you are logged in as root, the command
# echo "1073741824" > /proc/sys/kernel/shmmax
Once you run this command, simply retry the Oracle Database
Configuration Assistant, and it should work the second time.
Remember, this step is not always necessary. Whether you will
need to do it depends on a variety of factors, including how much
memory you have installed in your system. Only do it if the
Database Configuration Assistant failed without it.
Once the Database Configuration Assistant finishes creating an
initial database, you will be prompted for SYS and SYSTEM passwords
for the new database:
|

|
Enter the desired passwords, then click "OK" to continue.
The Oracle Installer will display a final status screen,
summarizing what services are running
|
|
Simply click "Exit" to leave the finished installation. The
installer will prompt you for confirmation:
|
Click "Yes", and the Installer will exit. You are now finished
installing Oracle, and can safely delete your temporary
/orainst directory and the Oracle installation files you
copied in /tmp.
|
The Oracle Enterprise Manager should start up automatically
after the installation is finished.
|

|
|
Use this or command-line tools such as sqlplus to verify
that you can connect to your newly installed database.
Several post-install configuration steps are also good at this
point. Typically, the system should be configured to start Oracle
automatically at boot time. As root, the command
# chkconfig --level 345 oracle on
will ensure that Oracle automatically starts when the system boots
normally.
In addition to starting the Oracle server processes, any desired
databases should be configured to be started by Oracle when it
boots up. Edit /etc/oratab to specify databases which should
be started. By default, created databases will be listed in this
file with directives which look like
*:/opt/oracle:N
ora1:/opt/oracle:N
The "N" indicates that Oracle should not automatically start these
databases. Simply change all entries for desired databases to "Y":
*:/opt/oracle:Y
ora1:/opt/oracle:Y
then save the file.
By default, all created databases will be world-readable. As
root, the command
# chmod 770 /opt/oracle/oradata
should be used to ensure that the Oracle database directory is not
world- readable.
In addition, the root.sh script generated during install should
be backed up. It is occasionally needed later, and subsequent
installations of Oracle products will overwrite it. As root, the
command
# cp /opt/oracle/root.sh /opt/oracle/root.sh-install
will ensure that a copy of the initial generated root.sh script is
always available.
At this point, Oracle should be installed and ready for your DBA
to put to use!
|
All trademarks used are properties of their
respective owner.
Copyright © 2003 by Guru Labs, L.C., All rights
reserved.
|
|