启动脚本代码

#!/bin/bash
#
# /etc/init.d/oracledb
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface
export ORACLE_HOME=/your/oracle/home/goes/here
export ORACLE_SID=oraclesidgoeshere
export PATH=$PATH:$ORACLE_HOME/bin
ORA_OWNR="oracleownergoeshere"
# if the executables do not exist -- display error
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_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 "$ORACLE_HOME/bin/lsnrctl start"
su $ORA_OWNR -c $ORACLE_HOME/bin/dbstart
touch /var/lock/oracle
su $ORA_OWNR -c “$ORACLE_HOME/bin/emctl start dbconsole”
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
su $ORA_OWNR -c $ORACLE_HOME/bin/dbshut
rm -f /var/lock/oracle
su $ORA_OWNR -c “$ORACLE_HOME/bin/emctl stop dbconsole”
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1
esac
exit 0

//script中有两行的引号有问题.把引号改一下.就可以.
另原脚本中无isqlplus的启动.可自行加入:
su $ORA_OWNR -c “$ORACLE_HOME/bin/isqlplusctl start”
su $ORA_OWNR -c “$ORACLE_HOME/bin/isqlplusctl stop”
如不加入从客户端浏览器中无法访问.也可以手动启动.
将这个文件放到指定的位置并让它可执行, 将它连接到所有的运行级:
#chmod 755 /etc/init.d/oracledb
#update-rc.d oracledb defaults 99
如果你希望在系统启动时启动你创建的所有数据库实例,那么需要修改
/etc/oratab 文件. 下面是一个例子:
oracle:/opt/oracle/:N
修改为
oracle:/opt/oracle:Y