当前位置: 代码迷 >> Oracle管理 >> 怎么设置在Linux启动后,Oracle也启动,监听也启动
  详细解决方案

怎么设置在Linux启动后,Oracle也启动,监听也启动

热度:49   发布时间:2016-04-24 05:28:46.0
如何设置在Linux启动后,Oracle也启动,监听也启动?
我的Oracle版本是:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
Linux版本是:
Linux version 2.6.18-194.el5 (mockbuild@x86-007.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Tue Mar 16 21:52:43 EDT 2010

------解决方案--------------------
SQL code
1 修改/etc/oratab的内容把sid:$ORACLE_HOME:N 改成sid:$OEACLE_HOME:Y比如orcl:/oracle/product/10.2.0/db_1:N改成orcl:/oracle/product/10.2.0/db_1:Y注意 如果 /etc/oratab的文件不存在 需运行如下命令 创建Sh /oracle/ORACLE/product/10.2.0/db_1/root.sh(格式 sh  /oracle_home/root.sh)2在/etc/init.d/目录下配置Oracle的服务文件命令如下:cd /etc/init.d/touch oracle10gchmod a+x oracle10g然后在oracle10g加入如下内容 (Vi /etc/rc.d/init.d/oracle10g)# !/bin/bash# whoami# root# chkconfig: 345 51 49# /etc/init.d/oracle10g# description: starts the oracle dabase deamons#ORA_HOME=/oracle/ORACLE/product/10.2.0/db_1/  ---这里是我的oracle目录 ORA_OWNER=oraclecase "$1" instart)echo -n "Starting oracle10g: "su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart" &su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"touch /var/lock/subsys/oracle10gecho;;stop)echo -n "shutting down oracle10g: "su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut" &su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"rm -f /var/lock/subsys/oracle10gecho;;restart)echo -n "restarting oracle10g: "$0 stop$0 startecho;;*)echo "Usage: `basename $0` start|stop|restart"exit 1esacexit 0按esc键 :wq 保存退出打开终端执行:chmod 775 /etc/rc.d/init.d/oracle10g设定oracle10g服务的启动级别cd /etc/rc.d/init.d/chkconfig --add oracle10g  ---加服务列表chkconfig --list oracle10g   ---查看结果(比如chkconfig --list oracle10g   运行结果:oracle10g   0:off 1:off 2:off 3:on 4:on 5:on 6:off)3. 在 /etc/rc.d/rc.local上加上下面的内容(vi /etc/rc.d/rc.local)su - oracle -c 'dbstart' su - oracle -c 'lsnrctl start'按esc键 :wq 保存退出
  相关解决方案