Next Previous Contents

5. Post-installation

The Oracle Installation Guide describes a very long list of procedures to be done after the installation process. Some of them are necessary, some of them probably in your instance you will never need, but most importantly this document will not repeat them.

Please refer to the Installation Guide for this procedures. Here I will describe steps that are very helpful for the minimal installation that I used, and seem enough for the basic database operations.

5.1 Editing the oratab file

There is one step in particular that is important, so that you may start and shutdown the database from the command prompt any time, or to allow the database to be autostarted during boot. Go to the /etc directory and edit the file oratab. In the line:

ORTD:/u01/app/oracle/product/9.2.0.1.0:N

set the last value to Y and it should read:

ORTD:/u01/app/oracle/product/9.2.0.1.0:Y

Now save the file and go back to your Oracle home directory.

5.2 Script for automatic startup on boot

It is generally a good idea to automate the database startup at boot time on your database server. In this case you will need a script, which can be included in the run-level sets. Here is an example only. Please, tune it to your own machine and run-levels!



#!/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

You can simply copy and paste this file into your system and change it according to your settings.

Once you copy and edit the file, move it to the /etc/rc.d/init.d directory and change it's ownership and the attributes to be the same as the other files in the directory.

To do that and the following operations, you will need to be logged as root user.

The fifth line of this code reads:

# chkconfig: 345 91 19

It is used by the chkconfig command when setting the scripts in the run-levels. The value 345 lists the run-levels in which we allow Oracle to run, so if you want to be able to run an Oracle instances only in levels 3 and 5, then change this value to 35. The next value (91) describes the order number in the startup sequence. This means that if there are 100 startup processes, the Oracle startup will be the 91st to run. The next number is the shutdown number, meaning that when the system is shutdown and there are for example 100 processes to be shutdown, the Oracle process will be 19 in order. These numbers are used to set the relative position of the Oracle startup and shutdown processes. They are set here as an example. You can change them, but keep in mind that Oracle instancse can not be run without some processes in the system running beforehand.

Now execute the following command:

chkconfig -add oracle

This will add the corresponding links in the run-level directories as listed in the beginning of the script.

To test the newly created automation, you have to reboot your system, but remember that before this automation runs, the kernel parameters should be set. In fact you may include the kernel tune commands in your start) section of the above script.

5.3 Testing your installation with SQL*Plus

If you have installed a typical database, there should be a user created called scott. The password is tiger. Just execute the following:

sqlplus scott/tiger

which should run the SQL*Plus interpreter and log in as user scott. You should see the screen like the following:



SQL*Plus: Release 9.2.0.1.0 - Production on Fri Feb 21 10:55:45 2003

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

Connected to:
Oracle9i Release 9.2.0.1.0 - Production
JServer Release 9.2.0.1.0 - Production

SQL>quit
Disconnected from Oracle9i Release 9.2.0.1.0 - Production
JServer Release 9.2.0.1.0 - Production

Before exiting you can do some SQL on your own to just see the tables in this database schema or whatever you have in mind.

>From this point on it is a matter of your own creativity and purpose.


Next Previous Contents