Getting Started With Oracle

I've sucessfully installed Oracle on SCO OpenServer and Linux and I've witnessed many Solaris installations.

When installing Oracle, the most common mistake I've made is having too little physical ram or swap. The second most common mistake I've made is not configuring the kernel with enough shared memory or semaphore resources. The installation instructions that come with Oracle for each platform indicate how much ram and swap you need and how to configure the kernel properly. I recommend meeting these requirements prior to installation.


Oracle versions 8.1.5-9.0.1 for Solaris have been or are currently available for download from or on CD. Installation appears to be as simple as following the directions. Note that for Solaris, these versions of Oracle will fail to create a database at installation time unless the kernel is configured properly to support more and larger shared memory segments and semaphores. Aside from neglecting this step, I've never seen or heard of anyone having much difficulty with these versions on Solaris.

SCO OpenServer

Oracle 7.3 is the most current version that runs on SCO OpenServer. It is was once available on CD but is currently out of production and no longer supported. I've installed it successfully on OpenServer 5.0.4 and 5.0.5 but have not been able to get it working on 5.0.6.

Oracle recommends that you configure your kernel to support more and larger shared memory segments and semaphores. I've never needed to do this to get the installation to complete or to run a small development database. For production systems however, I recommend following Oracle's recommendations.

If NIS is configured, you'll have lots of problems that won't show up until the very end of the installation. The installer scripts use domainname to get the DNS domain name of the machine it's being installed on. This is crazy because domainname returns the NIS domain name, not the DNS domain name, but the installation uses it to get the DNS domain name anyway. Installation works fine if the NIS domain name is not set (or if it happens to be set to the same name as the DNS domain name). Otherwise, all kinds of things break and can't be easily fixed after the installation is finished. If you really need NIS, configure it after installing Oracle.

Set the video mode to 1024x768 with 256 colors. The installer won't run in any other resolution or depth.

Install the COFF Linker Patch if it's available for your version of SCO OpenServer. It's currently available from the SCO OpenServer Support section of the Caldera web site. Without it, the installation will fail about halfway through.

To install Oracle 7.3, create a /mnt directory if one does not exist. Then insert the CD and run the following commands as root.

mount /dev/cd0 /mnt
cd /mnt

A graphical installation program should pop up shortly. The installation should proceed smoothly from there.


Oracle has supported Linux since version 8.0.5. Versions 8.0.5 through 9.0.1 have been or are currently available from and have been available on CD from various sources as well.

I've successfully installed Oracle 8.0.5 on RedHat 5.2, Oracle 8.1.6-8.1.7 on RedHat 6.2-7.2, and Oracle 8.1.7 on Mandrake 8.2, Debian 2.2r5 and Slackware 8. I've never been able to get any version to install on TurboLinux 7. I was once able to shoehorn Oracle 8.1.5 onto RedHat 6.1 (I think) but I have not been able to get it to install on any version since. I haven't tried any other Oracle versions on any other Linux distributions.

Create Users, Groups and Directories

Run the following commands as root to set up the appropriate users, groups and directories.

groupadd oinstall
groupadd dba
groupadd oper
mkdir /home/oracle
useradd oracle -g oinstall -G dba,oper
chown -R oracle:dba /home/oracle
passwd oracle
(assign the oracle user a password)
mkdir /u01
chown oracle:dba /u01
chmod 775 /u01

Edit /home/oracle/.bashrc and add the following command near the bottom.

umask 022
Configure the Kernel

Oracle recommends that you configure your kernel to support more and larger shared memory segments and semaphores. I've never needed to do this to get the installation to complete or to run a small development database. For production systems however, I recommend following Oracle's recommendations.

Install the Support Software

The Oracle installer needs the GNU C Compiler (gcc) and GNU Binutils (ar, as, ld, etc.) to compile and link several libraries at installation time. Make sure that these packages are installed.

Install Java

If you are installing Oracle 8.1.x, you need to install a Java Runtime Environment as well. You can download the appropriate JRE from blackdown.

For Oracle 8.1.6 you need to download jre118_v3-glibc-2.1.3.tar.bz2 and execute the following commands.

mv jre118_v3-glibc-2.1.3.tar.bz2 /usr/local
cd /usr/local
bunzip2 jre118_v3-glibc-2.1.3.tar.bz2
tar xf jre118_v3-glibc-2.1.3.tar
ln -s jre118_v3 java
rm jre118_v3-glibc-2.1.3.tar

Install Compatibility Packages

Oracle 8.0.5 for Linux requires glibc 2.0 and installs cleanly on RedHat 5. I've shoehorned it on to other platforms, but it was so hideous and worked so minimally that I dare not publish the process.

Oracle 8.1.x for Linux requires glibc 2.1. Many newer Linux distributions come with glibc 2.2. On these distributions it is necessary to install some compatibility packages.

Distributions that come with glibc 2.1 include RedHat 6, Debian 2.2, Mandrake 7 and Slackware 7. Distributions that come with glibc 2.2 include RedHat 7, Mandrake 8 and Slackware 8.

RedHat provides compatability RPM's for RedHat 7 that can actually be used on any Linux that comes with glibc 2.2. These RPM's can be downloaded from rpmfind. Even if you're installing on a non-RPM-based Linux distribution, you'll need the following RPM's.

RPM-based Linux

On an RPM-based linux distribution, you can install the RPM's using rpm -i.


On Slackware, you'll need to install RPM. The RPM package is available from You can install it using installpkg. Once RPM is installed, log in as root and run rpm --initdb.

For Slackware, you'll also need the binutils source RPM. Note that this is a source RPM, not a binary RPM.

Once RPM is installed and you have downloaded the compat-glibc, compat-egcs and binutils RPM's, run the following commands as root.

rpm -i --nodeps compat-glibc-6.2-
rpm -i --nodeps compat-egcs-6.2-
rpm -i --nodeps binutils-
cp /usr/src/rpm/SOURCES/binutils- /root
cd /root
bunzip2 binutils-
tar xf binutils-
cd binutils-
cp /usr/src/rpm/SOURCES/binutils- .
patch -p1 < binutils-
configure --prefix=/usr/local/binutils-glibc21
make install

If you don't get any errors, you should end up with a directory called /usr/local/binutils-glibc21 containing everything necessary to link Oracle against the glibc-2.1 provided by the compat RPM's.

Set Up the Environment

Edit /home/oracle/.bashrc and add the following command near the bottom.

. /usr/i386-glibc21-linux/bin/

If you are running a 2.4 (or higher) kernel, add the following line as well.

export LD_ASSUME_KERNEL=2.2.5

Edit /etc/profile and add the following somewhere near the top, replacing 8.1.7 in the ORACLE_VERSION environment variable with the version of Oracle that you are installing.

export ORACLE_VERSION=8.1.7
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=ora1
export CLASSPATH=$ORACLE_BASE/jdbc/lib/
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export ORACLE_OWNER=oracle
export ORACLE_TERM=386
export NLS_LANG=american

If you want to use a language other than US English, consult the following table and replace american with the appropriate language string.

Language NLS_LANG value
US Englishamerican
Brazilian Portugese"brazilian portugese"
Canadian Frenchfrc
Mexican Spanishesm
Simplified Chinese"simplified chinese"
Traditional Chinese"traditional chinese"

Install Oracle

At this point, you should be ready to install Oracle. Log in as the oracle user.

Oracle 8.0.5 has a text-based installer. Oracle 8.1.x have Java-based graphical installers. I've heard that the graphical installer has trouble with some versions of the Enlightenment window manager, but I've never experienced any difficulty myself.

If you are installing from a CD, mount the CD and cd to the directory it's mounted on. If you are installing from a download, extract the distribution using tar xfz.

Each version of Oracle has slightly different installation procedures. Follow the links below for the version of Oracle that you are installing. Note that on most platforms and for most versions of Oracle, the installation will fail at some point. Refer to the notes below for known issues and workarounds.

Installing Oracle 8.0.5
Oracle 8.1.6 is no longer available from and I don't have it lying around anymore so I can't write installation docs, but the installation procedure is similar to 8.1.7.
Installing Oracle 8.1.7
Known Issues and Workarounds

On Slackware and Debian, near the end of the installation, when the installer asks you to run, edit and change AWK=/bin/awk to AWK=/usr/bin/awk before running the script.

Starting the Database at Boot Time

You can use the following script to start/stop the database at boot/shutdown time. Replace /u01/app/oracle/product/8.1.7 with your $ORACLE_HOME


case "$1" in
        su -l oracle -c "/u01/app/oracle/product/8.1.7/bin/dbstart"
        su -l oracle -c "/u01/app/oracle/product/8.1.7/bin/lsnrctl start"
        su -l oracle -c "/u01/app/oracle/product/8.1.7/bin/dbshut"
        su -l oracle -c "/u01/app/oracle/product/8.1.7/bin/lsnrctl stop"
        echo $"Usage: $0 {start|stop}"
        exit 1

exit 0

Install this script and run it with the "start" option to start up the database. Running it with the "stop" option shuts the database down. To access a database, it must be running.

Creating a Database

During the installation, you could have chosen to create a database instance. If you did not create one during installation, you can do so afterward. For Oracle 8.1 and higher, login as oracle, run $ORACLE_HOME/bin/dbassist and following the on-screen instructions.

The dbassist program will ask you to provide an SID; a local identifier for the database. No two databases on the same machine can have the same SID. If you are using Oracle 8i or 9i you will also be asked to provide a Global Identifier. The Global Identifier should be unique among the Oracle databases on the local network.

After creating the database, edit the file /etc/oratab and look for a line containing the SID of the database you just created. Change the N at the end of that line to Y. This configures the database to start when the dbstart command is issued.

At this point, you can run the start/stop script to start up the database.

To access the database, the file $ORACLE_HOME/network/admin/tnsnames.ora must also be configured. This file contains an entry for each database that the local system needs to know about. Here is an example of a tnsnames.ora entry, identifying the database TESTDB on the local machine.

      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
      (SERVICE_NAME = testdb)

For Oracle 7 and 8, the format is SID = (... parameters ...). For Oracle 8i and 9i, the format is SID.DOMAIN = (... parameters ...). In this example the SID is TESTDB. The HOST parameter refers to the DNS name of the host that the database is running on. The SERVICE_NAME refers to the SID of the database as it is known on that host.

When a database instance is created, two special administration users are created: SYS and SYSTEM. The default password for the SYSTEM user is manager. The default password for the SYS user is change_on_install. These users own the tables that contain privileges and other housekeeping information.

The following command logs the SYSTEM user into the ORA1 instance:

sqlplus system/manager@testdb

Database tables are stored in a file or set of files collectively called a tablespace. The tables owned by the SYS and SYSTEM users are kept in their own tablespace. Though you could create your own tables there, it's not a good idea. You should create your own tablespace. The following queries create a tablespace and temporary tablespace called testtablespace and testtablespacetemp with some minimal sizing parameters.

	DATAFILE '/u01/app/oracle/oradata/ora1/scratchtour01.dbf' 

CREATE TABLESPACE scratchtourtemp
	DATAFILE '/u01/app/oracle/oradata/ora1/scratchtourtemp01.dbf' 

The set of database objects (such as tables, indexes, stored procedures and triggers) owned by a particular user is called a schema. Though schemas may be distributed across tablespaces, they are more often confined to a single tablespace. The SYSTEM and SYS schemas contain tables used by internal systems and should not be used for application data. You can create a new user and schema by logging in as SYSTEM and running the following queries:

CREATE USER testuser IDENTIFIED BY testpassword
	DEFAULT TABLESPACE testtablespace 
	TEMPORARY TABLESPACE testtablespacetemp;



Now you can exit and log in as the new user with the following command:

sqlplus testuser/testpassword@testdb

To delete a user and everything owned by that user, log in as SYSTEM and run the following command:


To delete a tablespace, log in as SYSTEM and run the following command:

DROP TABLESPACE testtablespace;

DROP TABLESPACE testtablespacetemp;

This should be enough you get you started. To set up more complex configurations, consult the documentation that came with your Oracle distribution.

Accessing a Database

Any user can access an Oracle database provided that the users environment is configured correctly. The ORACLE_HOME environment variable needs to be set to the same value that it was set for the oracle user during installation. The PATH varible must contain $ORACLE_HOME/bin and the LD_LIBRARY_PATH variable must contain $ORACLE_HOME/lib.

The user must have read access to the $ORACLE_HOME/network/admin/tnsnames.ora file. Alternatively, an individual user can have a .tnsnames.ora file.

The following command logs testuser with password testpassword into the database identified by the SID testdb.

sqlplus testuser/testpassword@testdb

A sample session follows.

[user@localhost user]$ sqlplus testuser/testpassword@testdb

SQL*Plus: Release - Production on Tue Jan 8 18:44:46 2002

(c) Copyright 2001 Oracle Corporation.  All rights reserved.

Connected to:
Oracle8i Enterprise Edition Release - Production
JServer Release - Production

SQL> create table testtable (
  2  col1 varchar2(40),
  3  col2 number
  4  );

Table created.

SQL> select table_name from user_tables;


SQL> describe testtable;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 COL1                                               VARCHAR2(40)
 COL2                                               NUMBER

SQL> insert into testtable values ('hello',50);

1 row created.

SQL> insert into testtable values ('hi',60);

1 row created.

SQL> insert into testtable values ('bye',70);

1 row created.

SQL> select * from testtable;

COL1                                           COL2
---------------------------------------- ----------
hello                                            50
hi                                               60
bye                                              70

SQL> delete from testtable where col2=50;

1 row deleted.

SQL> select * from testtable;

COL1                                           COL2
---------------------------------------- ----------
hi                                               60
bye                                              70

SQL> update testtable set col2=0 where col1='hi';

1 row updated.

SQL> select * from testtable;

COL1                                           COL2
---------------------------------------- ----------
hi                                                0
bye                                              70

SQL> drop table testtable;

Table dropped.

SQL> quit
Disconnected from Oracle8i Enterprise Edition Release - Production
JServer Release - Production

Accessing a Database With SQL Relay

Accessing Oracle from SQL Relay requires an instance entry in your sqlrelay.conf file for the database that you want to access. Here is an example sqlrelay.conf which defines an SQL Relay instance called oracletest. This instance connects to the testdb database as the user testuser with password testpassword.

<?xml version="1.0"?>
<!DOCTYPE instances SYSTEM "sqlrelay.dtd">

        <instance id="oracletest" port="9000" socket="/tmp/oracletest.socket" dbase="oracle" connections="3" maxconnections="5" maxqueuelength="0" growby="1" ttl="60" endofsession="commit" sessiontimeout="600" runasuser="nobody" runasgroup="nobody" cursors="5" authtier="listener" handoff="pass">
                        <user user="oracletest" password="oracletest"/>
                        <connection connectionid="oracletest" string="user=testuser;password=testpassword;sid=testdb" metric="1"/>


Now you can start up this instance with the following command.

sqlr-start -id oracletest

To connect to the instance and run queries, use the following command.

sqlrsh -id oracletest

The following command shuts down the SQL Relay instance.

sqlr-stop oracletest