My initial goal was to auto start/stop the oracle database and listener on AIX. Oracle suggested the following for starting and stopping the database (not the listener):
1. Create a file called dbora in the /etc directory.
2. chgrp dba /etc/dbora (change the group for the file permissions)
3. chmod 750 /etc/dbora (change the permissions of the file.)
4. add the following lines in the dbora file:
#! /bin/sh -x
#
# Change the value of ORACLE_HOME to specify the correct Oracle home
# directory for your installation.
ORACLE_HOME=/u01/app/oracle/product/ora10g
#
# Change the value of ORACLE to the login name of the
# oracle owner at your site.
#
ORACLE=oracle
PATH=${PATH}:$ORACLE_HOME/bin
HOST=`hostname`
PLATFORM=`uname`
export ORACLE_HOME PATH
#
if [ ! "$2" = "ORA_DB" ] ; then
if [ "$PLATFORM" = "HP-UX" ] ; then
remsh $HOST -l $ORACLE -n "$0 $1 ORA_DB"
exit
else
rsh $HOST -l $ORACLE $0 $1 ORA_DB
exit
fi
fi
#
case $1 in
'start')
$ORACLE_HOME/bin/dbstart $ORACLE_HOME &
;;
'stop')
$ORACLE_HOME/bin/dbshut $ORACLE_HOME &
;;
*)
echo "usage: $0 {start|stop}"
exit
;;
esac
#
exit
5. Now that we have the dbora file with the correct oracle user and oracle home, we simply create the soft links as follows:
# ln -s /etc/dbora /etc/rc.d/rc2.d/S99dbora
# ln -s /etc/dbora /etc/rc.d/rc2.d/K01dbora
6. You then have to edit the /etc/hosts.equiv file with the following entry:
host root (where the host is the name of the server)
My database now will auto start and stop when the AIX system is shutdown.
I tried doing the same thing for the listener with the following changes:
I created a dblsn file with the following changes in the script:
case $1 in
'start')
$ORACLE_HOME/bin/lsnstart $ORACLE_HOME &
;;
'stop')
$ORACLE_HOME/bin/lsnstop $ORACLE_HOME &
;;
*)
echo "usage: $0 {start|stop}"
exit
;;
esac
#
exit
The lsnstart script works when I run it from the user Oracle or root. It is as follows:
#
# Startup the oracle listener
#
export PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/ora10g
export ORACLE_SID=orasql
export AGENT_HOME=/u01/app/oracle/product/agent10g
/bin/su oracle -c /u01/app/oracle/product/ora10g/bin/lsnrctl start
For the /etc/dblsn file, I implemented the following soft links:
# ln -s /etc/dbora /etc/rc.d/rc2.d/S97dbora
# ln -s /etc/dbora /etc/rc.d/rc2.d/K03dbora
If it worked for the database, I thought it should work for the listener. When it didn't, I tried a different method for auto starting the listener:
1. I copied the lsnstart script above to the /etc directory and renamed it to rc.lsnstart
2. I then added the script to the inittab by using the following:
#/usr/sbin/mkitab "rclsnstart:2:wait:/etc/rc.lsnstart > /dev/console 2>&1"
If I do a telinit q, it should reread the inittab file and start the listener. It doesn't work.
So, I've tried two methods to automajically starting the oracle listener in an AIX environment with no luck. Any suggestions would be appreciated.
1. Create a file called dbora in the /etc directory.
2. chgrp dba /etc/dbora (change the group for the file permissions)
3. chmod 750 /etc/dbora (change the permissions of the file.)
4. add the following lines in the dbora file:
#! /bin/sh -x
#
# Change the value of ORACLE_HOME to specify the correct Oracle home
# directory for your installation.
ORACLE_HOME=/u01/app/oracle/product/ora10g
#
# Change the value of ORACLE to the login name of the
# oracle owner at your site.
#
ORACLE=oracle
PATH=${PATH}:$ORACLE_HOME/bin
HOST=`hostname`
PLATFORM=`uname`
export ORACLE_HOME PATH
#
if [ ! "$2" = "ORA_DB" ] ; then
if [ "$PLATFORM" = "HP-UX" ] ; then
remsh $HOST -l $ORACLE -n "$0 $1 ORA_DB"
exit
else
rsh $HOST -l $ORACLE $0 $1 ORA_DB
exit
fi
fi
#
case $1 in
'start')
$ORACLE_HOME/bin/dbstart $ORACLE_HOME &
;;
'stop')
$ORACLE_HOME/bin/dbshut $ORACLE_HOME &
;;
*)
echo "usage: $0 {start|stop}"
exit
;;
esac
#
exit
5. Now that we have the dbora file with the correct oracle user and oracle home, we simply create the soft links as follows:
# ln -s /etc/dbora /etc/rc.d/rc2.d/S99dbora
# ln -s /etc/dbora /etc/rc.d/rc2.d/K01dbora
6. You then have to edit the /etc/hosts.equiv file with the following entry:
host root (where the host is the name of the server)
My database now will auto start and stop when the AIX system is shutdown.
I tried doing the same thing for the listener with the following changes:
I created a dblsn file with the following changes in the script:
case $1 in
'start')
$ORACLE_HOME/bin/lsnstart $ORACLE_HOME &
;;
'stop')
$ORACLE_HOME/bin/lsnstop $ORACLE_HOME &
;;
*)
echo "usage: $0 {start|stop}"
exit
;;
esac
#
exit
The lsnstart script works when I run it from the user Oracle or root. It is as follows:
#
# Startup the oracle listener
#
export PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/ora10g
export ORACLE_SID=orasql
export AGENT_HOME=/u01/app/oracle/product/agent10g
/bin/su oracle -c /u01/app/oracle/product/ora10g/bin/lsnrctl start
For the /etc/dblsn file, I implemented the following soft links:
# ln -s /etc/dbora /etc/rc.d/rc2.d/S97dbora
# ln -s /etc/dbora /etc/rc.d/rc2.d/K03dbora
If it worked for the database, I thought it should work for the listener. When it didn't, I tried a different method for auto starting the listener:
1. I copied the lsnstart script above to the /etc directory and renamed it to rc.lsnstart
2. I then added the script to the inittab by using the following:
#/usr/sbin/mkitab "rclsnstart:2:wait:/etc/rc.lsnstart > /dev/console 2>&1"
If I do a telinit q, it should reread the inittab file and start the listener. It doesn't work.
So, I've tried two methods to automajically starting the oracle listener in an AIX environment with no luck. Any suggestions would be appreciated.