Installing Oracle 8.1.5 on Red Hat 6.1

(This document is a blatent rip-off of a more comprehensive version, by Jesus M. Salvo Jr., jmsalvo@ihug.com.au)

1. Preparing to Install

1.1 Obtain the Java Runtime Environment

When the documentation said to get the Java Runtime Environment, they do mean get the JRE 1.1.6v5, and not the JDK, from Blackdown. Get the glibc version, not the libc version. Use tar -zxf [filename] to extract from your tar.gz file. Extract it in any directory you like, but make sure to create a symbolic link named /usr/local/jre to the directory the extraction created, and that this directory is readable and executable by the Linux account oracle that you will create later on.
On my system, I am installing Oracle in /apps/oracle and my JRE is in /apps/oracle/jre116_v5. Therefore, I would use:

ln -s /apps/oracle/jre116_v5 /usr/local/jre
chmod 777 /apps/oracle/jre116_v5

1.2 Setup Linux groups and accounts

Create the Linux group dba and make oracle a member. In GNOME, under System is LinuxConf. Under User Accounts, Normal, Group definitions, add a group called dba. Then in user accounts, add oracle if you haven't already, making it a member of dba. I normally create oracle during the Red Hat installation, which means when I change oracle's group to dba, it warns me that the access for /home/oracle is invalid. Say yes to change the permissions if you get this message.

1.3 Setup environment variables

As oracle, add the following lines to /home/oracle/.bash_profile
ORACLE_BASE=/apps/oracle
ORACLE_HOME=$ORACLE_BASE/product/8.1.5
ORACLE_SID=ora815
ORACLE_PATH=$ORACLE_HOME/bin
LD_LIBRARY_PATH=$ORACLE_HOME/lib
PATH=$PATH:$ORACLE_PATH

export ORACLE_BASE ORACLE_HOME ORACLE_SID ORACLE_PATH LD_LIBRARY_PATH

Note: You should already have a export statement for PATH. Mine reads export USERNAME BASH_ENV PATH. Make sure this line comes after the lines you added, and that your lines come after the original PATH= line.

2. Installation

2.1 Run the Oracle Universal Installer

If you have just one Linux box with at least 196MB, then you can safely run X and install Oracle8i on that same box. If you only have 128MB, the installation may be slow.

Run install/linux/runIns.sh on the RedHat CD in Gnome.

The following headings correspond to the page headings in the Oracle Universal Installer.

Welcome

Click Next

File Locations

The source will default to the CD you're installing off, which should be fine.
The destination will be $ORACLE_HOME.
Click Next

Inventory Location

If this is a virgin Oracle install you'll get a window asking where your base directory should be. This is $ORACLE_BASE/oraInventory.
Click OK. If you get an error saying the location couldn't be created, you don't have write access to /apps/oracle. Use chmod 777 /apps/oracle from a terminal to correct this.

UNIX Group Name

Enter dba
Click Next

Oracle Universal Installer Window

Another window pops up telling you to run a script as root. This script will change the group ownership of $ORACLE_BASE/oraInventory to oinstall. If you were never prompted for this, either you have already installed Oracle8i before (and are just installing additional components) or the oracle account is not a member of dba. Change the group of oracle to dba.

If the Oracle Universal Installer suddenly dies, the problem is probably too small a memory. Try doing the following:

From a terminal type su (enter root password)
/tmp/orainstall/orainstRoot.sh
Click Retry.

Available Products

Select Oracle8i 8.1.5.0.0 Click Next

Installation Types

Select Custom
Click Next

Available Product Components

Tick everything you can. The reason for installing all Oracle options is due to a bug with the $ORACLE_HOME/bin/relink script. This script is ran after every upgrade or patch applied to Oracle8i. However, it seems that the script assumes all the library files, including those that come with the Oracle Options, are present. If it cannot find even one library file, the relinking fails.

If you happen to have applied the original 8.1.5.0.1 patch and noticed that sqlplus or svrmgrl still reports 8.1.5.0.0, that is because the relink failed due to missing library files. In my initial installations, I deselected all the Oracle options that are available for me to deselect. After applying the patch, a look at the error log (if you did made one) will show:

 /usr/bin/ld: Cannot open -lordsdo8: No such file or directory
It is much worse when you apply the 8.1.5.0.2 patch without the Oracle options installed. You are not even able to run svrmgrl:
 ORA-12545 Connect failed because target host or object does not exist.
Click Next

Component Locations

No need to select alternate locations. My Total Required Disk Space was 541Mb
Click Next

Create Database

Yes or No makes no difference, it runs it at the end of the installation anyway.
Click Next

Oracle Protocol Support

Don't worry if this is blank. As it says, native protocols (such as TCP/IP) are preselected.
Click Next

Summary

Click Install. It'll plonk a progress bar in the middle of the Summary screen. When it gets to 100% it'll display a spinny thing and carry on installing. Note the location of the log files shown below the progress bar.

My machine takes 9m15s from clicking Install to displaying the next dialogue.

Setup Priviledges

Root doesn't have execute rights to the file it asks you to run. From a terminal, as root,

cd /apps/oracle/product/8.1.5
chmod u+x root.sh
./root.sh
The script asks for the pathname of the local bin directory. You should be able to accept the default of /usr/bin by just pressing [ENTER].

Click OK in dialogue box.

Configuration Tools

You'll get the following error:
 JNLS Exception:oracle.ntp.jnls.JNLSException Unable to find anyNational Character Sets. Please check your Oracle
installation.
Don't worry. Click OK.

Oracle Database Configuration Assistant

Cancel this. We'll do it later.

Configuration Tools

Back in the OUI you'll get an error because you cancelled. Click OK.
Click Next.

End of Installation

We're not quite finished yet. We have to apply patches, enter our database parameters and create the database.
Click Exit

Apply patches

Get the patch - a task and a half itself!
If your patch is in /download you would type:

cd /apps/oracle
tar zxf /download/linux_815patches.tar.gz
cd linux_815patches
./linux_815patches.sh

When the patch script finishes it tells you to relink. In /apps/oracle/product/8.1.5/bin type relink all. Oracle Database Configuration Assistant In GNOME, run /apps/oracle/product/8.1.5/bin/dbassist
You'll get the JNLS blah blah blah error again. Just click OK.
Select Create a database
Click Next

Select Custom
Click Next

Select Hybrid
Click Next

Leave concurrently connected users at 15.
Click Next

Select Dedicated Server Mode
Click Next

Leave all options ticked.
Click Next

Enter linux815 as the Global Database Name.
The SID should be filled in already, ora815.
Leave the other options alone.
Click Next

Leave the control files and max. settings alone.
Click Next

Leave the tablespaces alone.
Click Next

Increase the two Redo Log files to 2000Kb. You can't enter a value, you must click the up arrows.
Click Next

Leave the logging parameters alone.
Click Next

Leave the SGA parameters alone.
Click Next

Leave the trace files alone.
Click Next

Select Save information to a shell script
Click Finish
This will help you understand what is happening in the background and help you diagnose any problem during database creation.
In the save dialogue, click OK.
OK everything else.

Run the scripts

In The scripts will be found in $ORACLE_HOME/install. You only need to run one script, as it calls all the other individual scripts in the correct order. I suggest that you run each script individually.

When you run the first script, named SIDrun.sh, it would have started the instance and created the SYSTEM datafile and tablespace, the control files, and the redo log files. Run the other scripts, named SIDrun1.sh and SIDrun2.sh.
My machine took 55mins with no errors.

DONT WORRY ABOUT THINGS NOT EXISTING WHIZZING UP THE SCREEN - IT'S DROPPING THINGS BEFORE IT CREATES THEM.


3. Post Database Creation Procedures

3.1 Update your init.ora file

The init.ora file created by the Database Assistant does not indicate the rollback segments to use. It is there but commented out, because the initial startup of the instance would not have these rollback segments created yet, apart from the rollback segment in SYSTEM.

So you need to update your init.ora file located in $ORACLE_BASE/admin/pfile and uncomment the line # rollback_segments = ...

3.2 Automate Database Startup and Shutdown

Automating database startup and shutdown is straightforward. Even if you do not want your database to automatically startup, you should always automate database shutdown to prevent corrupting your database. The steps involved are:
  1. su as root.
  2. Update /etc/oratab with a line in the form of ORACLE_SID:ORACLE_HOME:{Y|N}, replacing both ORACLE_SID and ORACLE_HOME with the values from your environment variables. In my case, the line appears as:
      ORCL:/home/oracle/app/oracle/product/8.1.5:Y
    The Y at the end of the line will indicate if you want the database to automatically startup and shutdown.
  3. Create a script in /etc/rc.d/init.d, name it oracle8i, and put lines of code shown below, which is a modified version of the script provided on the Oracle8i Linux Installation Guide.
    #!/bin/sh
    # Set ORA_HOME to be equivalent to the ORACLE_HOME
    # from which you wish to execute dbstart and
    # dbshut
    # set ORA_OWNER to the user id of the owner of the
    # Oracle database in ORA_HOME
    
    ORA_HOME=/home/oracle/app/oracle/product/8.1.5
    ORA_OWNER=oracle
    
    case "$1" in
          start)
    
    
          # Start the Oracle databases:
          # The following command assumes that the oracle login will not prompt the
    
          # user for any values
          echo -n "Starting Oracle8i: "
          su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
          touch /var/lock/subsys/oracle8i
          echo
          ;;
    
          stop)
    
          # Stop the Oracle databases:
          # The following command assumes that the oracle login will not prompt the
    
          # user for any values
          echo -n "Shutting down Oracle8i: "
          su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
          rm -f /var/lock/subsys/oracle8i
          echo
          ;;
    
          restart)
    
          # Restart the Oracle databases:
          echo -n "Retarting Oracle8i: "
          $0 stop
          $0 start
          echo
          ;;
    
          *)
          echo "Usage: oracle8i { start | stop | restart }"
          exit 1
    
    esac
    exit 0
    Make sure to replace the value for ORA_HOME with the value of your ORACLE_HOME environment variable.
  4. Test that the script actually works. Try the following:
      chmod u+x oracle8i
      ./oracle8i stop
      ./oracle8i start
      ./oracle8i restart
      ./oracle8i invalid-parameter
  5. Create a link to the script that you have just created to automate database shutdown. Runlevel 0 is HALT while runlevel 6 is REBOOT. In my case, I did:
      ln -s /etc/rc.d/init.d/oracle8i /etc/rc.d/rc0.d/K10oracle8i
      ln -s /etc/rc.d/init.d/oracle8i /etc/rc.d/rc6.d/K10oracle8i
    The script will get executed whenever the system changes its runlevel to 0 or 6, which happens when you issue /sbin/shutdown -h now and /sbin/shutdown -r now, respectively.
  6. Optionally, create a link to the script that you have created to automate database startup. I chose runlevel 3 as this is the default runlevel for RedHat 6.0. In my case, I did:
      ln -s /etc/rc.d/init.d/oracle8i /etc/rc.d/rc3.d/S99oracle8i
  7. oracle needs access to /var/lock/subsys, so exit from root back to oracle. If touch /var/lock/subsys/oracle8i gives permission denied, su root again and chmod 777 /var/lock/subsys. If it did work, and the database is down, make sure you rm it again.

3.3 Setting up a Listener

I have the following defined in $ORACLE_HOME/network/admin/listener.ora:
LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = linuxbox)(PORT = 1521))
    (PROTOCOL_STACK =
      (PRESENTATION = TTC)
      (SESSION = NS)
    )
  )
What you need to do are: Note that we did not indicate what database service(s) the listener should accept connections for. Apparently Oracle8i databases will dynamically register with the listener.

Time to test that the listener starts. Startup the listener by typing:

    lsnrctl start
Here is what I get:
LSNRCTL for Linux: Version 8.1.5.0.0 - Production on 05-JAN-00 18:13:35

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

Starting /apps/oracle/product/8.1.5/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 8.1.5.0.0 - Production
System parameter file is /apps/oracle/product/8.1.5/network/admin/listener.ora
Log messages written to /apps/oracle/product/8.1.5/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linuxbox)(PORT=1521))(PROTOCOL_STACK=(PRESENTATION=TTC)(SESSION=NS)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=linuxbox)(PORT=1521))(PROTOCOL_STACK=(PRESENTATION=TTC)(SESSION=NS)))

STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 8.1.5.0.0 - Production
Start Date                05-JAN-00 18:13:35
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  OFF
SNMP                      OFF
Listener Parameter File   /apps/oracle/product/8.1.5/network/admin/listener.ora
Listener Log File         /apps/oracle/product/8.1.5/network/log/listener.log
The listener supports no services
The command completed successfully

You will notice that the listener is configured to listen for the TCP protocol on port 1521.

3.4 Configuring Net8 for Local Naming Method

Next, we need to configure $ORACLE_HOME/network/admin/tnsnames.ora. Even if we will end up using Oracle Names Server, we can load the tnsnames.ora file later on to Oracle Names Server. Furthermore, this allows us to test that a network connection to the database can be made via the listener what we have setup before even using Oracle Names Server. Here are the contents of my tnsnames.ora file:
ORCL.COMPANY.COM.AU =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.1)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl.company.com.au)
    )
  )
  
What you need to do are:
  1. Replace the first line (ORCL.COMPANY.COM.AU) with a name that you want to give to your net service plus your domain name. If you remove the domain name, you will need to append a dot on certain commands such as tnsping later on.
  2. Replace the value of HOST on the fourth line with the host name or IP address where your Oracle8i database is installed.
  3. If you specified a port other than 1521 for your listener in listener.ora, change it in this file as well.
  4. Replace the value of SERVICE_NAME on the 7th line with the value of your global database name that you specified during database creation prompted by the Database Assistant. It is usually the database name followed by a dot and the domain name.

3.5 Configuring SQLNET.ORA

Here is the configuration of my $ORACLE_HOME/network/admin/sqlnet.ora:
NAMES.PREFERRED_SERVERS =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = dbhost)(PORT = 1575))
  )

NAMES.DEFAULT_DOMAIN = company.com.au
SQLNET.EXPIRE_TIME = 0
NAMES.DIRECTORY_PATH= (TNSNAMES)
SQLNET.CRYPTO_SEED = 4fhfguweotcadsfdsafjkdsfqp5f201p45mxskdlfdasf
  
What you need to do are:
  1. Ignore NAMES.PREFERRED_SERVERS for the mean time. It is used later on when connecting via Oracle Names Server. In any case, change the value after HOST to the hostname where Oracle Names Server is installed. In my case, this is the same machine where 8i is installed. Port 1575 is used as the port where Oracle Names Server listens for connections. So this entry simply tells clients that it should try to contact an Oracle Names Server at dbhost on port 1575.
  2. Change the value of NAMES.DEFAULT_DOMAIN to your domain name.
  3. CRYPTO_SEED is not important. You can remove it in your own file. I simply posted a copy of my sqlnet.ora file, while changing the domain names and IP addresses. If you want to know what it is for:
    Net8 Administrator's Guide Release 8.1.5 (A67440-01)
    Part III - Reference
    C. Configuration Files, Profile Paramaters (SQLNET.ORA)
    SQLNET.CRYPTO_SEED

    Purpose:
        Specifies the characters used when generating cryptographic keys. The more random the characters are, the stronger the keys     are. This is required whenever encryption or checksumming is turned on. The string should be 10-70 random characters.

    Default:
        qwertyuiopasdfghjkl;zxcvbnm,.s1
    Example:
        sqlnet.crypto_seed="qwertyuiopasdfghjkl;zxcvbnm,.s1"

Note that NAMES.DIRECTORY_PATH is set to TNSNAMES. This means it will use and only use local naming method (via the tnsnames.ora file) to resolve net service names to network addresses. Hence, even though we have an entry for NAMES.PREFERRED_SERVER, it will not use this yet as it is only for connecting via Oracle Names Server.

3.6 Testing Net8 connection using Local Naming Method

We will use two tools to test the connection to the listener. Of course, all of this test will work okay when ran on the same machine where the listener is running. If you have another machine with the Oracle8i client software installed, try running tnsping from there, provided you have setup both tnsnames.ora and sqlnet.ora on the client machine.

Keep in mind that because we have NAMES.DIRECTORY_PATH= (TNSNAMES) in sqlnet.ora, we are indeed testing Net8 using the local naming method. All clients that will connect to the database using local naming method needs a sqlnet.ora and tnsnames.ora file.

If you are content with using local naming method, then you may want to skip to "Configuring the Listener for IIOP Connections". If you are not interested in IIOP connections, then skip to "Automating Startup and Shutdown of Listener". If you are interested in setting Oracle Names Server (you paid for it), read on.

3.7 Configuring Net8 for Host Naming Method

The good thing about both Host Naming and Oracle Naming Method is that you no longer need a tnsnames.ora file on each client that needs to be connect to the database. However, you still need sqlnet.ora.

In here, I made use of a DNS server (BIND) to resolve the service name to an IP address. I assume that your DNS server must be already working. Here are the steps that I did to make this work:

  1. Make sure you have setup a listener listening for TCP/IP connection on the default port 1521. See "Setting up a Listener" for a sample configuration of listener.ora
  2. Modify your sqlnet.ora file so that it will make use of host naming method.
      DIRECTORY_PATH = (HOSTNAME)
    This tells client programs (such as tnsping and sqlplus) to use host naming method.
  3. In my /var/named/named.company.com.au BIND configuration file, I added:
      orcl            CNAME   ns
    You probably realized by now that BIND, Oracle, and the listener are running on the same machine. Anyway, replace orcl with your net service name. To make things simpler for me, my ORACLE_SID is the same as my db_name and instance_name in initSID.ora and is also the same as the net service name. The only thing different is the service_name in my initSID.ora, which has the domain name attached to it.
  4. su as root, and restart named. I sometimes keep forgetting the exact binary and parameters to be passed, so I just call the rc script for named in /etc/rc.d/init.d/, and did the following:
      /etc/rc.d/init.d/named restart
  5. Test that the name can be resolved with nslookup.
        Server:  localhost
        Address:  127.0.0.1
    
        Name:    ns.company.com.au
        Address:  192.168.0.1
        Aliases:  orcl.company.com.au

3.8 Testing Net8 Connection using Host Naming Method

Run the following first on the same machine where the listener is running:
  tnsping netservice
  tnsping netservice.company.com.au
Replace netservice with your own net service name, which should be the name or alias you just added in your BIND configuration file. Both tests should work fine.

Keep in mind that tnsping will only test the connection to the listener, not the database or instance itself. So we need to do an actual connection to the database using sqlplus. On the same machine where the listener and database is running, try each of the following:

Try the above tests on a separate machine, making sure the separate machine knows where to find the DNS server. Both tnsping should work okay, but the results of sqlplus are different (at least in my case). On a separate machine, only the third sqlplus works.

I avoided this configuration and instead used Oracle Naming Method, as all three sqlplus works.

3.9 Testing Net8 connection using Oracle Names Method

There is nothing different between testing a Net8 connection using local or Oracle Names method.

Try running tnsping from the same machine where Oracle Names Server is running, as we have already configured the configuration files. Then on another machine, to make sure you are using Oracle Names Server to resolve service names to network addresses, make sure you only have ONAMES in NAMES.DIRECTORY_PATH of your sqlnet.ora file.

Then do a tnsping orcl and sqlplus system/manager@orcl. Of course, replace orcl with the name that you have given to your net service name. To prove that it is actually using Oracle Names Server, try renaming tnsnames.ora on the client machine to something else, then run tnsping and sqlplus again. If you are satisfied, then you can delete tnsnames.ora from the client machine.

Keep in mind that once we are using only Oracle Names Server (as specified in the NAMES.DIRECTORY_PATH), then you need a Names Server up and running to be able to resolve net service names to network addresses and connect to the database from client machines. Of course, this excludes the BEQ protocol.

You can also use tcpdump and listen for network connections to port 1575.

3.8 Automating Startup and Shutdown of Listener

Thanks goes to Moors Willem for saving me some typing ( and testing ) for the scripts to automate startup and shutdown of the Oracle8i listener.