oracle随linux OS自动启动与关闭
在linux 上装的oracle ,每次开机都要手动启动oracle服务,想做到自动,改了好些天,可能是做的虚拟ASM原因一直服务启动出错,先不说ASM,let oracle instance automatic startup and close
环境:rhel 5 linux +oracle 10g
—–NOW BEGIN—————-
用root 登录
1,vi /etc/oratab;
内容如下,orcl换成本机的实例名,Y为开机启动
+ASM:/u01/app/oracle/product/10.2.0/db_1:N -----没ASM这部省略
orcl:/u01/app/oracle/product/10.2.0/db_1:Y
2,在/etc/init.d 下新建一文件create an file ,
touch /etc/init.d/oracle10g
3,oracle10g 内容
vi /etc/init.d/oracle10g
—复制一下内复到oracle10g中如果oracle_home不同,只需要修改一下ORACLE_HOME
# description: Oracle auto start-stop script.
#
# Set ORACLE_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORACLE_HOME.
ORACLE_HOME=/oracle/product/10.2.0/db_1
ORA_OWNER=oracle
if [ ! -f $ORACLE_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start" >>/tmp/ora_start.log
exit
fi
case "$1" in
start)
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl start"
su - $ORA_OWNER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
touch /var/lock/subsys/dbora
;;
stop)
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop"
rm -f /var/lock/subsys/dbora
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
-----------完 ,!wq 保存吧-------
Notice:
网页可能因为编码原因,注意修改ORACLE_HOME为你自己的环境,注意全角引号和- 的手动替换一下。
4,文件权限
chgrp dba oracle10g
chmod 750 oracle10g
5,建立软链接
# ln -s /etc/init.d/oracle10g /etc/rc.d/rc3.d/K01oracle10g
# ln -s /etc/init.d/oracle10g /etc/rc.d/rc3.d/S99oracle10g
# ln -s /etc/init.d/oracle10g /etc/rc.d/rc5.d/K01oracle10g
# ln -s /etc/init.d/oracle10g /etc/rc.d/rc5.d/S99oracle10g
6修改$ORACLE_HOME/bin/dbstart中ORACLE_HOME_LISTNER
# Set this to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=$ORACLE_HOME
-------------好 完成------
重启操作系统试试吧
对不起,这篇文章暂时关闭评论。