Centos5.6 oracle 10g 开机启动数据库配置
|
系统 |
数据库版本 |
实现功能开机自动启动 ORACLE |
|
Centos5.6 |
10.2.0.1 |
很复杂,今天来学习 |
1、 修改 /etc/oratab 修改成Y
2、 修改 $ORACLE_HOME/bin/dbstart
ORACLE_HOME_LISTENER=$ORACLE_HOME ( dbstart )
3、 修改 ORACLE_SID=dba 默认会是 orcl
如果这里不修改 export ORACLE_SID=dba, 会报下面的错误
logger: Can't find init file for Database instance "orcl".
logger: Error: Database instance "orcl" NOT started.
4、 创建 ora 脚本
#!/bin/bash
# chkconfig: 2345 99 01
## (这里跟我们 chkconfig –add ora 有关)(这里很重要如果你不设置,就不能添加 chkconfig ,不能自动启动数据库了。) ##
# description: Startup Script. for Oracle Databases
# /etc/rc.d/init.d/oradbstart
ORA_OWNR="dba"
# 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/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/emctl stop dbconsole"
su - $ORA_OWNR -c "$Oracle_HOME/bin/dbshut"
su - $ORA_OWNR -c "$Oracle_HOME/bin/lsnrctl stop"
rm -f /var/lock/Oracle
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1
esac
exit 0
5、 修改执行权限 chmod 755 ora
6、 修改 chkconfig ora on 开机自动启动
chkconfig –add ora
chkconfig –list ora
chkconfig ora on
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26442936/viewspace-730649/ ,如需转载,请注明出处,否则将追究法律责任。