Linux下设置Oracle实例和监听自启动

1、编辑文件/etc/init.d/nodeManagerService

设置 Oracle 实例和监听服务自启动

复制代码 代码如下:

1.  增加启动脚本

[oracle@weblogic-01 ~]$ vi /etc/init.d/nodeManagerService

touch /etc/init.d/orcl

#!/bin/bash
#chkconfig: 345 80 70
#description: start stop nodemanager
WL_HOME=”/home/oracle/Oracle/Middleware/wlserver_10.3″
BEA_OWNER=”oracle”

vi orcl

case “$1” in
start)
su – “$BEA_OWNER” <<EOF
${WL_HOME}/server/bin/startNodeManager.sh &
EOF

# !/bin/bash

stop)
su – “$BEA_OWNER” <<EOF

# whoami

EOF

# root

*)

# chkconfig: 345 51 49

esac

# /etc/init.d/orcl

2、修改权限

# description: starts the oracle dabase deamons

复制代码 代码如下:

#

chmod a+x /etc/init.d/nodeManagerService

ORA_HOME=/home/oracle/product/10.2.0/db_1/

3、添加到开关机服务里

ORA_OWNER=oracle

复制代码 代码如下:

case “$1” in

chkconfig –add nodeManagerService
[html]

start)

4、查看启动级别
[code]
chkconfig –list nodeManagerService

echo -n “Starting orcl: “

5、重启机器查看是否生效

su – $ORA_OWNER -c “$ORA_HOME/bin/dbstart” &

在linux 开机启动界面会看到开机服务中有:  nodeManagerService [ok]

su – $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl start”

6、删除开关机服务

touch /var/lock/subsys/orcl

复制代码 代码如下:

echo

chkconfig –del nodeManagerService

;;

您可能感兴趣的文章:

stop)

echo -n “shutting down orcl: “

su – $ORA_OWNER -c “$ORA_HOME/bin/dbshut” &

su – $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl stop”

rm -f /var/lock/subsys/orcl

echo

;;

restart)

echo -n “restarting orcl: “

$0 stop

$0 start

echo

;;

*)

echo “Usage: `basename $0` start|stop|restart”

exit 1

esac

exit 0

保存 orcl 并退出

2.  增加配置服务

/sbin/chkconfig –add orcl

3.  修改 /etc/oratab 文件

vi /etc/oratab

ORACLE_SID:ORACLE_HOME:Y   —  是否自启动

4.  重启测试一下

或者简单的配置 /etc/rc.d/rc.local 增加两条启动命令

su – oracle -c /home/oracle/product/10.2.0/db_1/bin/dbstart

su – oracle -c /home/oracle/product/10.2.0/db_1/bin/lsnrctl start

http://www.bkjia.com/Linuxjc/599079.htmlwww.bkjia.comtruehttp://www.bkjia.com/Linuxjc/599079.htmlTechArticle设置 Oracle 实例和监听服务自启动 1. 增加启动脚本
touch /etc/init.d/orcl vi orcl # !/bin/bash # whoami # root #
chkconfig: 345 51 49 # /etc/init.d/orcl # descripti…