by John K. Joachim
Oracle RDBMS is a full-featured relational database management system from Oracle Corporation. It includes a set of administration tools, and precompilers for most programming languages. This article will cover how to install and configure an Oracle database on Linux.
The installation file for Oracle 8.0.5 Enterprise Edition is named Oracle8051EE_Intel.tgz. It can be downloaded from ftp://technet.oracle.com/. If needed, the glibc patch file glibcpatch.tgz can be downloaded from ftp://ftp.oracle.com/pub/www/otn/linux/.
Oracle currently uses glibc 2.0 rather than glibc 2.1. Oracle has supplied a patch which, when combined with compatibility RPM packages, allows it to run on Red Hat 6.0. I chose to use the Linux-Mandrake 6.0 distribution for this installation. If you are not using 6.0, you can skip the steps for installing the compatibility RPMs and the glibc patch. It is possible to install Oracle on other distributions, but since Oracle uses Red Hat for its development, Red Hat (or some variation of Red Hat) is preferred.
The C Development package must be installed when you install Linux. If you want to install Oracle's Intelligent agent, you must have tcl-8.0.3-20.i386.rpm installed. To install the JDBC drivers, you must define a path to your classesxxx.zip file.
I recommend creating a minimum of three partitions for Oracle. This allows you to use Oracle's Optimum Flexible Architecture (OFA) standard. Using OFA gives you the capability to segregate data from indexes and have multiple control files. The partitions should be named u01, u02 and u03. You can create more partitions if you have the disks to support them. I have two disks on my machine, so I created a partition of 1GB for /u01 and 150MB for /u02. I then created a directory called /u03 to give me the equivalent of another mount point. The first partition (/u01) is where the Oracle executables and all associated files will be placed during the installation process. The remaining mount points will be used for data files, indexes and control files.
A multitude of directories are created during the installation process. Some of the more important ones are:
The installation is broken down into 8 steps:
rpm -ivh compat-binutils-5_2-2_9_1_0_23_1_i386.rpm rpm -ivh compat-glibc-5_2-2_0_7_1_i386.rpm rpm -ivh compat-egcs-5_2-1_0_3a_1_i386.rpm rpm -ivh compat-egcs-c++-5_2-1_0_3a_1_i386.rpm rpm -ivh compat-libs-5_2-1_i386.rpmEdit /etc/passwd for root and change the shell from /bin/bash to /bin/sh. This will make the installation scripts supplied by Oracle run without errors.
Create the groups and users used by Oracle. At a minimum, you will need a group called dba for the oracle user. You may also want to create a group called oper for the operation of the database. Refer to the Database Administrator's Guide for Oracle to determine whether you want to create this group. In the following example, I used only the dba group, with a group ID of 601. You may need to use a different group ID if 601 is already in use on your system. Be sure to change the password for the oracle user.
groupadd -g 601 dba useradd oracle -g 601 passwd oracleEdit /etc/passwd as root to change the default shell.
Create the directories for your mount points if you didn't create them as partitions. Repeat the commands for all three mount points if necessary.
mkdir /u01 chown -R oracle.dba /u01Change to the directory where you have unpacked the Oracle8051EE_Intel.tgz file (this is your staging directory for the installation process), and run the script to create the /etc/oratab file. This file is used by Oracle's startup script to determine which instances are running on the machine, and whether they should autostart when the machine is rebooted. More on this file later.
cd /home/oracle/orainst/orainst ORACLE_OWNER=oracle; export ORACLE_OWNER sh oratab.sh
Log out as root and log in as oracle. Make sure umask is set to 022 by typing umask. If it is not set to 022, you will need to add a line to your .profile file. Set the following environment variables in oracle's .profile:
ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/product/8.0.5 ORACLE_SID=greg #(replace with your system #identifier) ORACLE_TERM=386 PATH=$PATH:/u01/app/oracle/product/8.0.5/bin TMPDIR=/var/tmp export ORACLE_BASE ORACLE_HOME ORACLE_SID\ ORACLE_TERM export PATH TMPDIR umask 022 #(only if the umask is not already #set to 022)Log out, then log back in as oracle. Make sure the environment variables are set by using the env command, and that /bin:/usr/bin:/usr/local/bin is in your path.
cd /home/oracle/orainst/orainst ./orainst /cSelect the custom install
Read the preamble.txt file and press return to continue. Read the README.FIRST
file and press return to continue. Select Install, Upgrade or De-install
Software
Select Install New Product--Do Not Create DB Objects
Make sure the ORACLE_BASE and ORACLE_HOME environment
variables are set correctly.
Press return to accept the defaults for your log files. It's a good
idea to make a note of their locations, too. If anything goes wrong during
the installation process, you may need to look at them. It is also a good
idea to look at them even if everything works fine in order to learn more
about the installation process.
Select Install from Staging Area .
Make sure the staging area is set correctly. In my example, I used /home/oracle/orainst..
Select your language.
Press return to acknowledge the location of the root.sh post-install script. The default location is /u01/app/oracle/product/8.0.5/orainst/root.sh. Select the following products to install.
Select dba as your DBA group.
If you decided to create a separate group for operation of the database,
enter it for the OSOPER group.
For this install, I used the dba group as the OSOPER
group.
At this point, the installer will begin copying the software. This is a good time to take a break, since this could take a while--how long will depend on the speed of your machine.
When the software installation process is complete, you should get a
message that says ``The requested action has been performed for selected
products.''
Press return to acknowledge the message, tab to Exit, then press return. tab to indicate Yes on the Confirmation and press return to exit the installer. The installer should exit with the message ``Result: Success''.
ln -s /u01/app/oracle/doc /u01/app/oracle/product/8.0.5Start the installer from your staging directory (./orainst /c). Select custom install. Click on OK to bypass the README files. Select Install, Upgrade or De-install software. Select Add/Upgrade Software. Press enter to acknowledge the environment variable setting for ORACLE_HOME. Press enter to acknowledge the location of the log files. Select Install from Staging Area. Press enter to acknowledge the path of the staging area. Select the appropriate language. Select Append to append to the root.sh script created during the software installation process. This is done because we haven't run the script yet, and we don't want to overlay the script created in the previous step. Press return at the Information screen, which gives the location for the root.sh script. Select the Intel LINUX Documentation and tab to install. Press return to begin the installation process. Press return to acknowledge the location of the on-line documentation
Select the format (HTML or PDF) you want for the on-line documentation..
Once again, we're looking for the message, ``The requested action has been performed for selected products.'' Press return to acknowledge the message, tab to Exit, then press return. Select Yes from the Confirmation screen to exit the installer. Again, we hope to see the installer exit with a message of ``Result: Success''.
Change to the /orainst directory and run the root.sh script.
cd $ORACLE_HOME/orainst sh root.shVerify ORACLE_OWNER, ORACLE_HOME and ORACLE_SID are correct. If they are, enter Y.
When it asks for the full path name to your local bin directory, enter
/usr/local/bin. The script then tells you ORACLE_HOME does not
match the home directory for oracle. This is not a problem. Type
a Y and continue. The script will complete. (See below)
Log on as oracle and shut down the instance (see below).
svrmgrl connect internal shutdown exit
The oratab file is located in the /etc directory. This file is read by the dbstart file which we will use to automatically start the instance when the machine is rebooted. There are comments in the oratab file which explain the three fields and what they contain. Change the last field to Y for instances in which you want to start when the machine is rebooted. The file should look something like Listing 1.
Listing 1.
# This file is used by ORACLE utilities. It is
# created by root.sh and updated by the Oracle8
# and SQL*Net install procedures.
# A colon, ':', is used as the field terminator.
# A new line terminates the entry. Lines beginning
# with a pound sign, '#', are comments.
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:
# The first and second fields are the system
# identifier and home directory of the database
# respectively. The third field indicates to the
# dbstart utility that the database should, "Y", or
# should not, "N", be brought up at system boot
# time.
# Multiple entries with the same $ORACLE_SID are
# not allowed.
#*:/u01/app/oracle/product/8.0.5:N
#
greg:/u01/app/oracle/product/8.0.5:Y
The listener.ora file is located in the $ORACLE_HOME/network/admin directory. This file is used by Net8 to determine how network connections are made to the instance(s) on your machine. Update the listener.ora file with the sid to which the Net8 listener should listen. Replace oracle_sid with the sid name. The file should look something like Listing 2.
Listing 2.
# Installation Generated Net8 Configuration
# Version Date: Jun-17-97
# Filename: Listener.ora
#
LISTENER =
(ADDRESS_LIST =
(ADDRESS= (PROTOCOL= IPC)(KEY= greg))
(ADDRESS= (PROTOCOL= IPC)(KEY= PNPKEY))
(ADDRESS= (PROTOCOL= TCP)(Host= den.bearcave)
(Port= 1521))
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME= den.bearcave.)
(ORACLE_HOME= /u01/app/oracle/product/8.0.5)
(SID_NAME = greg)
)
(SID_DESC =
(SID_NAME = extproc)
(ORACLE_HOME = /u01/app/oracle/product/8.0.5)
(PROGRAM = extproc)
)
)
STARTUP_WAIT_TIME_LISTENER = 0
CONNECT_TIMEOUT_LISTENER = 10
TRACE_LEVEL_LISTENER = OFF
The tnsnames file is located in the $ORACLE_HOME/network/admin directory. This file is used by Net8 to determine the location for remote databases you can connect to. Replace oracle_sid with the sid name. The file should look something like Listing 3.
Listing 3.
# Installation Generated Net8 Configuration
# Version Date: Oct-27-97
# Filename: Tnsnames.ora
#
extproc_connection_data =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = greg))
(CONNECT_DATA = (SID = extproc))
)
greg =
(DESCRIPTION =
(ADDRESS = (PROTOCOL= TCP)(Host= den.bearcave)
(Port= 1521))
(CONNECT_DATA = (SID = greg))
)
greg_BEQ =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = BEQ)(PROGRAM =
/u01/app/oracle/product/8.0.5)
(argv0 = oraclegreg)
(args = '(DESCRIPTION
= (LOCAL=YES)
(ADDRESS=(PROTOCOL=BEQ)))')
(envs =
'ORACLE_HOME=/u01/app/oracle/product/8.0.5,ORACLE_SID=greg')
)
)
As root, issue the following commands to set the permissions correctly for the Net8 files:
chown oracle.dba $ORACLE_HOME/bin/tnslsnr chmod 750 $ORACLE_HOME/bin/tnslsnr chown oracle.dba $ORACLE_HOME/network/log chmod 775 $ORACLE_HOME/network/log chown root.dba \ $ORACLE_HOME/network/log/listener.log chmod 664 $ORACLE_HOME/network/log/listener.logIf you receive an error because the listener.log doesn't exist, you will need to enter the last two commands after you stop and start the listener.
svrmgrl connect internal startup exitConnect to the database using SQL*Plus:
sqlplus system system_password select count(*) from dba_objects; #(This should # return a count of the number of objects in the # database) exitStart the TNS listener:
lsnrctl startYou should see something like this:
Connect to the database using SQL*Plus through a network connection. This can be done using only one machine if you don't really have a network installed.
sqlplus system/system@greggreg refers to the entry in the $ORACLE_HOME/network/admin/tnsnames.ora file
select count(*) from dba_objects; exit
ln -s/etc/rc.d/init.d/dbora /etc/rc.d/rc0.d/K10dbora ln -s/etc/rc.d/init.d/dbora /etc/rc.d/rc2.d/S99dbora ln -s/etc/rc.d/init.d/dbora /etc/rc.d/rc3.d/S99dbora ln -s/etc/rc.d/init.d/dbora /etc/rc.d/rc5.d/S99dbora ln -s/etc/rc.d/init.d/dbora /etc/rc.d/rc6.d/K10dboraListing 4.
Listing 5.
ORACLE_HOME=/u01/app/oracle/product/8.1.5
export ORACLE_HOME
$ORACLE_HOME/bin/lsnrctl start
Listing 6.
ORACLE_HOME=/u01/app/oracle/product/8.1.5
export ORACLE_HOME
$ORACLE_HOME/bin/lsnrctl stop
Place the file dbora (Listing 4) in /etc/rc.d/init.d. Place the file lsnrstart (Listing 5) in the $ORACLE_HOME/bin directory. Place the file lsnrstop (Listing 6) in the $ORACLE_HOME/bin directory.
The listener and all Oracle instances designated to automatically start in the /etc/oratab file should shut down and restart when the machine is rebooted.
At this point, the database has been created. You can use SQL*Plus to create tables. If you are unfamiliar with SQL, there are a number of good books available on the subject.
You still need to create your dba group, oracle user, directories and mount points.
Download and install JRE (or JDK) 1.1.6 v5 from http://www.blackdown.org/. Create a symbolic link for the directory in which you installed JRE.
ln -s jre_install_location /usr/local/jreMount the CD-ROM which contains the Oracle8i software:
mount -t iso9660 /dev/cdrom /mnt/cdromLog on as oracle and change directories to the CD-ROM and start the installer:
cd /mnt/cdrom ./runInstallerYou should see a welcome screen like this:
Click ``Next''. You will be prompted for the location of the installation
jar file and your Oracle home directory. Make any necessary changes and
click ``Next'' .
Enter the dba group you created in the previous step and click ``Next''.
You will be prompted to run /tmp/OraInstall/orainstRoot.sh . After you
run it, you should see the following lines of output:
Creating Oracle Inventory pointer file (/etc/oraInst.loc) Changing group name of /u01/app/oracle/product/oraInventory to dba. Return to the pop-up window and click Retry.
You will be prompted to install the Oracle8i Enterprise Server, Oracle8i
Client or Oracle Programmer. Select the ``Enterprise Server'' and click
``Next''.
You will be prompted for the type of install. Select ``Custom'' and
click ``Next''.
You will be prompted for which products you want to install.
After you have selected the products to install, click ``Next''. You
can change the locations the products will be installed in or click ``Next''
to take the defaults
You will be prompted to create the database using the Oracle Database
Configuration Assistant (DBCA). Select ``Yes'' and click ``Next''.
You will be prompted for the Global Database Name and the SID. Modify
the screen capture to reflect your names.
You will be prompted for the location of your database files. In my
example, I used the mount point /u01.
You will prompted to select which network protocol(s) to install based
on which protocols are present on your machine click ``Next''.
You will see a summary of your install options. This will allow you
to use the ``Previous'' button to change any settings that are incorrect
.
When you are ready to begin the install process click ``Install''. The
install screen will list where the log file from the install is being written.
This information will come in handy if something goes wrong during the
installation. When the install is complete, you will see a pop-up window.
Note the location of the script to run as root, change to the directory where the root.sh script is located and run it. You may have to change the permissions on it to make it executable.
cd /u01/app/oracle/product/8.1.5 export ORACLE_OWNER=oracle export ORACLE_SID=greg chmod 700 root.sh ./root.shAfter the root.sh script successfully executes return to the pop-up message and click ``OK''.
At this point the installation is complete, and you can click ``Next'', then ``Exit''. The testing and automation procedures are the same as in the previous section for Oracle 8.0.5.