[root@test11 root]# more /etc/init.d/oracle
#!/bin/sh
#chkconfig: 2345 80 05
#description: Oracle 8 Server
ORA_HOME=/oracle/product/9.2.0
ORA_OWNER=oracle
case "$1" in
"start")
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
su - $ORA_OWNER -c "$ORA_HOME/bin/start.sh"
;;
"stop")
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
su - $ORA_OWNER -c "$ORA_HOME/bin/shutdown.sh"
;;
esac
[root@test11 root]# more /oracle/product/9.2.0/bin/start.sh
sqlplus /nolog << EOF
connect / as sysdba
startup
exit
exit
echo "oracle have started"
[root@test11 root]# more /oracle/product/9.2.0/bin/shutdown.sh
sqlplus /nolog << EOF
connect / as sysdba
shutdown immediate
exit
exit
echo "oracle have shutdown"
#chkconfig --add oracle
#!/bin/sh
#chkconfig: 2345 80 05
#description: Oracle 8 Server
ORA_HOME=/oracle/product/9.2.0
ORA_OWNER=oracle
case "$1" in
"start")
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
su - $ORA_OWNER -c "$ORA_HOME/bin/start.sh"
;;
"stop")
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
su - $ORA_OWNER -c "$ORA_HOME/bin/shutdown.sh"
;;
esac
[root@test11 root]# more /oracle/product/9.2.0/bin/start.sh
sqlplus /nolog << EOF
connect / as sysdba
startup
exit
exit
echo "oracle have started"
[root@test11 root]# more /oracle/product/9.2.0/bin/shutdown.sh
sqlplus /nolog << EOF
connect / as sysdba
shutdown immediate
exit
exit
echo "oracle have shutdown"
#chkconfig --add oracle
博客展示了在Linux系统下操作Oracle服务的脚本。包含在/etc/init.d/oracle文件中定义的启动和停止服务的脚本,以及start.sh和shutdown.sh文件中具体的启动和关闭数据库操作,还涉及chkconfig添加服务配置。

1647

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



