Linux 环境下开机自启动Oracle服务
使用如下命令查看Oracle相关服务是否已启动:
ps aux | grep ora_ #若无ora_**_**相关的进程,则oracle数据库实例未启动
netstat -tlnup | grep 1521 #若无任何显示,则监听器未启动
lsnrctl status #查看监听器状态
netstat -tlnup | grep 1158 #若无任何显示,则EM未启动
emctl status dbconsole #查看EM状态
1.启动数据库实例还得打开Oracle设置的一个关卡:vi /etc/oratab,修改行:
[root@localhost ~]# vi /etc/oratab
# orcl:/u01/app/oracle/product/11.2.0/db_1:N
orcl:/u01/app/oracle/product/11.2.0/db_1:Y
2.在linux 的/etc/init.d/ 添加oracle 服务,以root身份建立开机启动oracle服务的脚本:vi /etc/init.d/oracle,添加如下脚本:
[root@localhost ~]# su - oracle
[oracle@localhost ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/db_1
[oracle@localhost ~]$ su - root
密码:
[root@localhost ~]# touch /var/log/oracle.log
[root@localhost /]# vi /etc/init.d/oracle
#!/bin/sh$ #chkconfig: 2345 20 80 #description: Oracle dbstart / dbshut # It is that is needed for chkconfig ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 ORA_OWNER=oracle LOGFILE=/var/log/oracle.log echo "#################################" >> ${LOGFILE} date +"### %T %a %D: Run Oracle" >> ${LOGFILE} if [ ! -f ${ORACLE_HOME}/bin/dbstart ] || [ ! -f ${ORACLE_HOME}/bin/dbshut ]; then echo "Error: Missing the script file ${ORACLE_HOME}/bin/dbstart or ${ORACLE_HOME}/bin/dbshut!" >> ${LOGFILE} echo "#################################" >> ${LOGFILE} exit fi start(){ echo "###Startup Database..." su - ${ORA_OWNER} -c "${ORACLE_HOME}/bin/dbstart ${ORACLE_HOME}" echo "###Done." echo "###Run database control..." su - ${ORA_OWNER} -c "${ORACLE_HOME}/bin/emctl start dbconsole" echo "###Done." } stop(){ echo "###Stop database control..." su - ${ORA_OWNER} -c "${ORACLE_HOME}/bin/emctl stop dbconsole" echo "###Done." echo "###Shutdown Database..." su - ${ORA_OWNER} -c "${ORACLE_HOME}/bin/dbshut ${ORACLE_HOME}" echo "###Done." } case "$1" in 'start') start >> ${LOGFILE} ;; 'stop') stop >> ${LOGFILE} ;; 'restart') stop >> ${LOGFILE} start >> ${LOGFILE} ;; esac date +"### %T %a %D: Finished." >> ${LOGFILE} echo "#################################" >> ${LOGFILE} echo ""
oracle服务器启动脚本
2.1使用如下命令将 /etc/init.d/oracle 置为可执行文件:
[root@localhost /]# chmod a+x /etc/init.d/oracle
2.2至此,可使用如下命令对oracle进行启动和关闭:
[root@localhost /]# /etc/init.d/oracle start
[root@localhost /]# /etc/init.d/oracle stop
[root@localhost /]# /etc/init.d/oracle restart
3.将oracle服务 添加到 chkconfig中,设置为系统服务:
[root@localhost /]# chkconfig --add oracle
[root@localhost /]# chkconfig | grep oracle
oracle 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
3.1使用如下命令查看和设置oracle服务的开机启动级别:
[root@localhost /]# chkconfig --level 24 oracle off #修改oracle服务的开机启动级别
[root@localhost /]# chkconfig --level 35 oracle on #修改oracle服务的开机启动级别
4.至此,所添加的服务已经作为linux中的服务了,可使用如下命令对oracle的启动或关闭进行管理:
[root@localhost /]# service oracle stop
[root@localhost /]# service oracle start
5.建立连接:
[root@localhost /]# ln -s /etc/init.d/oracle /etc/rc0.d/K01oracle #关机执行
[root@localhost /]# ln -s /etc/init.d/oracle /etc/rc6.d/K01oracle #重启执行
5.1 rc.d说明:
[root@localhost ~]# ls /etc/rc.d/
init.d rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d
0 - 停机
1 - 单用户模式
2 - 多用户,但是没有NFS ,不能使用网络
3 - 完全多用户模式,我最喜欢的模式
4 - “打酱油” 模式,没有用到
5 - X11 桌面模式
6 - 重新启动 (如果将默认启动模式设置为6,Linux将会不断重启)
rc#.d 其中#代表系统运行级别
Linux 环境下开机自启动Oracle服务的更多相关文章
- Centos7 环境下开机 自启动服务(service) 设置的改变 (命令systemctl 和 chkconfig用法区别比较)
参考文章: <Linux 设置程序开机自启动 (命令systemctl 和 chkconfig用法区别比较)> http://blog.csdn.net/kenhins/article/ ...
- iServer-Linux环境下开机自启动实现
备注:该方案的前提是linux环境下已经安装部署好了iServer 1.在/etc/init.d/目录下创建iserver服务脚本文件. [root@localhost /]# vim /etc/in ...
- 在Linux环境下设置ArcGIS Server 服务开机自启
在 VMware 11.0 中安装了CentOS 6.5的Linux系统中部署ArcGIS Server,安装完后默认开机不自动启动此服务,每次开机都要手动启动(如下图所示),这样太麻烦.本文记录了设 ...
- Linux环境下安装配置vsftpd服务(三种认证模式)
一.FTP简介 文件传输协议(英文:File Transfer Protocol,缩写:FTP)是用于在网络上进行文件传输的一套标准协议.它工作于网络传输协议的应用层,使用客户/服务器模式,主要是用来 ...
- linux 系统下开机自动启动oracle 监听和实例 (亲测有效)
[oracle@oracle11g ~]$ dbstartORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listene ...
- 在Linux环境下的对启动服务进行停止或在运行
下面我以elasticsearch服务为例进行: 第一种: 1.前台运行: 运行结果 2.ctrl+c停止运行 第二种:后端运行 1.后端运行的命令./elasticsearch -d 这种启动后 ...
- linux环境下安装oracle步骤和自启动oracle
oracle安装步骤 一.创建用户 --注释-- /etc/passwd 用户配置文件 /etc/shadow 用户密码文件 /etc/group 组 组用户文件/etc/gshadow 组密码文件 ...
- 全世界最详细的图形化VMware中linux环境下oracle安装(一)【weber出品必属精品】
安装流程:前期准备工作--->安装ORACLE软件--->安装升级补丁--->安装odbc创建数据库--->安装监听器--->安装EM <前期准备工作> 安装 ...
- 全世界最详细的图形化VMware中linux环境下oracle安装(二)【weber出品必属精品】
<ORACLE 10.2.05版本的升级补丁安装> 首先我们解压 $ unzip p8202632_10205_LINUX.zip 解压后我们会发现多出了个文件夹,他是:Disk1,进入D ...
随机推荐
- windows操作系统的快捷键
编号:1015时间:2016年5月26日09:25:34功能:windows操作系统的快捷键URL:https://www.douban.com/group/topic/5937774/
- static 静态代码块 动态代码块 单例
1. 共享,不属于对象,属于类,类成员变量,任何一个类的对象都有该属性,一旦被修改,则其他对象中的该属性也被更改. 2. 类中方法是static的,可以通过类名直接访问,不用new一个该类的对象. 3 ...
- tensorflow0.8.0 安装配置
参考官网:https://www.tensorflow.org/ Ubuntu15.10 + Eclipse Mars.2(4.5.2)官网最新 + Anaconda3-4.0.0 + Pydev4 ...
- python numpy 模块简单介绍
用python自带的list去处理数组效率很低, numpy就诞生了, 它提供了ndarry对象,N-dimensional object, 是存储单一数据类型的多维数组,即所有的元素都是同一种类型. ...
- 跟开涛老师学shiro -- 编码/加密
在涉及到密码存储问题上,应该加密/生成密码摘要存储,而不是存储明文密码.比如之前的600w csdn账号泄露对用户可能造成很大损失,因此应加密/生成不可逆的摘要方式存储. 5.1 编码/解码 Shir ...
- 12. Integer to Roman
Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 t ...
- CollectionsAPI
鉴于总用,总结一下: 类别 方法 查找 binarySearch. 返回 enumeration.checkedSortedMap 判断 max.min 移动 reverse(List).revers ...
- html5的特性
1.简化的语法更简单的doctype声明是HTML5里众多新特征之一.现在你只需要写,这就行了.HTML5的语法兼容HTML4和XHTML1,但不兼容SGML. 2. 一个替代Flash的新”canv ...
- leetcode 102 Binary Tree Level Order Traversal ----- java
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, ...
- POJ 1426 Find The Multiple --- BFS || DFS
POJ 1426 Find The Multiple 题意:给定一个整数n,求n的一个倍数,要求这个倍数只含0和1 参考博客:点我 解法一:普通的BFS(用G++能过但C++会超时) 从小到大搜索直至 ...