设置数据库自启脚本:
cd /usr/u01/app/product/11.2.0/dbhome_1/bin
[oracle@200-168-1-4 bin]$ vi dbstart
添加:
ORACLE_HOME="/usr/u01/app/product/11.2.0/dbhome_1"
修改:
ORACLE_HOME_LISTNER=$ORACLE_HOME
[oracle@200-168-1-4 bin]$ vi dbshut
添加:
ORACLE_HOME="/usr/u01/app/product/11.2.0/dbhome_1"
修改:
ORACLE_HOME_LISTNER=$ORACLE_HOME
--配置需要启动的实例:格式:$ORACLE_SID:$ORACLE_HOME:[Y|N]
[oracle@200-168-1-4 bin]$ vi /etc/oratab
lubinsu:/usr/u01/app/product/11.2.0/dbhome_1:Y
lubinsu:/usr/u01/app/product/11.2.0/dbhome_1:Y
新建自启脚本:
[root@200-168-1-4 init.d]# cat oralubinsu#!/bin/sh
# chkconfig: 345 61 61
# description: Oracle 11g release 2 autorun services
JAVA_HOME=/home/lubinsu/soft/app/jdk7
CLASSPATH=/usr/u01/app/product/11.2.0/dbhome_1/JRE:/usr/u01/app/product/11.2.0/dbhome_1/jlib:/usr/u01/app/product/11.2.0/dbhome_1/rdbms/jlib
ORACLE_BASE=/usr/u01/app; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=lubinsu; export ORACLE_SID
export JAVA_HOMEexport CLASSPATH
export PATH=$PATH:$ORACLE_HOME/bin
ORA_OWNR="oracle"
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
# of the instance and listener or usage display
start)
# Oracle listener and instance startup
su $ORA_OWNR -lc $ORACLE_HOME/bin/dbstart
echo "Oracle Start Succesful!OK."
;;
stop)
# Oracle listener and instance shutdown
su $ORA_OWNR -lc $ORACLE_HOME/bin/dbshut
echo "Oracle Stop Succesful!OK."
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo $"Usage: `basename $0` {start|stop|reload|reload}"
exit 1
esac
exit 0echo "Oracle Start Succesful!OK."
;;
stop)
# Oracle listener and instance shutdown
su $ORA_OWNR -lc $ORACLE_HOME/bin/dbshut
echo "Oracle Stop Succesful!OK."
;;
;;
stop)
# Oracle listener and instance shutdown
su $ORA_OWNR -lc $ORACLE_HOME/bin/dbshut
echo "Oracle Stop Succesful!OK."
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo $"Usage: `basename $0` {start|stop|reload|reload}"
exit 1
--记住,下面这两行是必须的,固定格式:
# chkconfig: 345 61 61
# description: Oracle 11g release 2 autorun services
--加入启动程序中:
# chkconfig --add oralubinsu
--现在还可以这么启动关闭数据库:
[root@200-168-1-4 init.d]# service oralubinsu stop
Processing Database instance "lubinsu": log file /usr/u01/app/product/11.2.0/dbhome_1/shutdown.log
Oracle Stop Succesful!OK.
[root@200-168-1-4 init.d]# service oralubinsu start
Processing Database instance "lubinsu": log file /usr/u01/app/product/11.2.0/dbhome_1/startup.log
Oracle Start Succesful!OK.
866

被折叠的 条评论
为什么被折叠?



