Centos 6.4下Oracle启动&停止脚本
来源:互联网 发布:tim kaine知乎 编辑:程序博客网 时间:2024/05/20 02:26
1. 修改Oracle系统配置文件:/etc/oratab,只有这样,Oracle 自带的dbstart和dbshut才能够发挥作用。
<span style="font-size:14px;"># This file is used by ORACLE utilities. It is created by root.sh# and updated by the Database Configuration Assistant when creating# a database.# A colon, ':', is used as the field terminator. A new line terminates# the entry. Lines beginning with a pound sign, '#', are comments.## Entries are of the form:# $ORACLE_SID:$ORACLE_HOME:<N|Y>:## The first and second fields are the system identifier and home# directory of the database respectively. The third filed indicates# to the dbstart utility that the database should , "Y", or should not,# "N", be brought up at system boot time.## Multiple entries with the same $ORACLE_SID are not allowed.###orcl:/trs/oracle/112:Norcl:/trs/oracle/112:Y</span>
2. 在 /etc/init.d/ 下创建文件oracle,内容如下:
#!/bin/sh# chkconfig: 35 80 10# description: Oracle auto start-stop script.## Set ORA_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 ORA_HOME.ORA_HOME=/trs/oracle/112ORA_OWNER=oracleif [ ! -f $ORA_HOME/bin/dbstart ]then echo "Oracle startup: cannot start" exitficase "$1" in'start')# Start the Oracle databases:echo "Starting Oracle Databases ... "echo "-------------------------------------------------" >> /var/log/oracledate +" %T %a %D : Starting Oracle Databases as part of system up." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oraclesu - $ORA_OWNER -c "$ORA_HOME/bin/dbstart" >>/var/log/oracleecho "Done"# Start the Listener:echo "Starting Oracle Listeners ... "echo "-------------------------------------------------" >> /var/log/oracledate +" %T %a %D : Starting Oracle Listeners as part of system up." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oraclesu - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start" >>/var/log/oracleecho "Done."echo "-------------------------------------------------" >> /var/log/oracledate +" %T %a %D : Finished." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oracletouch /var/lock/subsys/oracle;;'stop')# Stop the Oracle Listener:echo "Stoping Oracle Listeners ... "echo "-------------------------------------------------" >> /var/log/oracledate +" %T %a %D : Stoping Oracle Listener as part of system down." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oraclesu - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop" >>/var/log/oracleecho "Done."rm -f /var/lock/subsys/oracle# Stop the Oracle Database:echo "Stoping Oracle Databases ... "echo "-------------------------------------------------" >> /var/log/oracledate +" %T %a %D : Stoping Oracle Databases as part of system down." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oraclesu - $ORA_OWNER -c "$ORA_HOME/bin/dbshut" >>/var/log/oracleecho "Done."echo ""echo "-------------------------------------------------" >> /var/log/oracledate +" %T %a %D : Finished." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oracle;;'restart')$0 stop$0 start;;esac
3. 改变文件权限
# chmod 755 /etc/init.d/oracle
4. 添加服务
# chkconfig --level 35 oracle on
5. 需要在关机或重启机器之前停止数据库,做一下操作
# ln -s /etc/init.d/oracle /etc/rc0.d/K01oracle //关机
# ln -s /etc/init.d/oracle /etc/rc6.d/K01oracle //重启
6. 使用方法
# service oracle start //启动oracle
# service oracle stop //关闭oracle
# service oracle restart //重启oracle
0 0
- Centos 6.4下Oracle启动&停止脚本
- Linux下,Oracle自动启动,停止脚本 (转载)
- linux下oracle重启、启动、停止脚本
- Linux下停止,启动ORACLE
- 启动和停止Oracle服务bat脚本
- 启动和停止oracle bat脚本
- centos 下停止,启动服务命令
- CentOS 6.5 下启动和停止Nginx
- CentOS下启动和停止Tomcat
- openstack下停止/启动虚拟机脚本
- CentOS下nginx启动脚本
- CentOS Jboss7的一个初始化脚本(用于启动、停止)
- Linux Oracle服务启动&停止脚本与开机自启动
- Linux Oracle服务启动&停止脚本与开机自启动
- Linux Oracle服务启动&停止脚本与开机自启动
- Linux Oracle服务启动&停止脚本与开机自启动
- Linux Oracle服务启动&停止脚本与开机自启动
- Linux Oracle服务启动&停止脚本与开机自启动
- mongoDB修改器之$set
- DnsApi简单探索(2) DNS_QUERY_REQUEST struct
- MATLAB中点除点除
- DXVA -- VDPAU -- CUVID -- VAAPI
- EF Code first
- Centos 6.4下Oracle启动&停止脚本
- 开源slides工具
- sch 助shell脚本加密 02
- 美术资源的网站
- mongoDB修改器之$inc
- 2014年总结
- 堆排序(HeapSort)
- 黑马程序员——解4道与 NSArray、NSString 知识点有关的编程题
- 用文件简单的的学生信息管理(第一次用,好多不懂的地方,大家多指正)