1) Configure Oracle to automatically start the Oracle database whenever the dbstart script is
executed, and to automatically shutdown the Oracle database whenever the dbshut script is
executed. Type:
vi /etc/oratab
On the last line, change the third parameter from N to Y to auto-start/stop the database.
2) Log in as root.
3) Create a file containing commands to startup or shutdown the Oracle database. Type:
vi /etc/rc.d/init.d/dbora
The file should look similar to the following:
#!/bin/bash
#
# /etc/rc.d/init.d/dbora
#
# Oracle database startup/shutdown script for Linux
#
# Set ORA_HOME to be equivalent to the ORACLE_HOME from
# which you wish to execute dbstart and dbshut
#
ORA_HOME=/u01/app/oracle/product/8.1.6
PATH=$PATH:$ORA_HOME/bin; export PATH
#
# Set ORA_OWN to the user id of the owner of
# the Oracle database in ORA_HOME
#
ORA_OWN=oracle
#
# Set LD_LIBRARY_PATH so Oracle can find the
# dynamic link libraries it needs (mainly for lsnrctl)
LD_LIBRARY_PATH=$ORA_HOME/lib; export LD_LIBRARY_PATH
#
if [ ! -f $ORA_HOME/bin/dbstart -o ! -d $ORA_HOME ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
start)
ps -ef | grep -v grep | grep ora_.*_.* > /dev/null
if [ $? -ne 0 ]
then
#
# Start the Oracle database
#
su $ORA_OWN -c $ORA_HOME/bin/dbstart
fi
#
# Start Net8:
#
su $ORA_OWN -c "$ORA_HOME/bin/lsnrctl start"
#
;;
stop)
# Stop the Oracle databases
ps -ef | grep -v grep | grep ora_.*_.* > /dev/null
if [ $? -eq 0 ]
then
su $ORA_OWN -c $ORA_HOME/bin/dbshut
fi
;;
esac
4) Set required permissions on the oracle file:
chmod 744 /etc/rc.d/init.d/dbora
Kommentare zu diesen Handbüchern