CentOS 6下 Oracle11gR2 设置开机自启动
[1] 更改/etc/oratab
# 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:/usr/oracle/app/product/11.2.0/dbhome_1:Y
[2] oracle用户profile文件中增加SID环境变量
[root@oracledb oracle]# vi /usr/oracle/.bash_profile
# 在文件末尾添加
export ORACLE_SID=orcl
[3] 创建启动Oracle的Init脚本
[root@oracledb oracle]# vi /etc/rc.d/init.d/oracle
# this is an example
#!/bin/bash # oracle: Start/Stop Oracle Database 11g R2
#
# chkconfig: 345 90 10
# description: The Oracle Database is an Object-Relational Database Management System.
#
# processname: oracle . /etc/rc.d/init.d/functions LOCKFILE=/var/lock/subsys/oracle
ORACLE_HOME=/usr/oracle/app/product/11.2.0/dbhome_1
ORACLE_USER=oracle case "$1" in
'start')
if [ -f $LOCKFILE ]; then
echo $0 already running.
exit 1
fi
echo -n $"Starting Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole"
touch $LOCKFILE
;;
'stop')
if [ ! -f $LOCKFILE ]; then
echo $0 already stopping.
exit 1
fi
echo -n $"Stopping Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
rm -f $LOCKFILE
;;
'restart')
$0 stop
$0 start
;;
'status')
if [ -f $LOCKFILE ]; then
echo $0 started.
else
echo $0 stopped.
fi
;;
*)
echo "Usage: $0 [start|stop|status]"
exit 1
esac exit 0
[4] 更改启动脚本权限
[root@oracledb oracle]# chmod 755 /etc/rc.d/init.d/oracle
[5] 启动oracle数据库
[root@oracledb oracle]# service oracle start
[6] 关闭oracle数据库
[root@oracledb oracle]# service oracle stop
[7] 设置oracle为开机自启动
[root@oracledb oracle]# chkconfig oracle on
[root@oracledb oracle]# chkconfig --list oracle
oracle 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
[root@oracledb oracle]#
[8]重启电脑测试
原文地址:
CentOS 6下 Oracle11gR2 设置开机自启动的更多相关文章
- Centos7下Redis设置开机自启动服务
有个同事说重启了服务器没有自启动redis,我看了一下,是以前手动编译安装的模式,没有配置开机启动的服务 这边做个笔记记录一下redis如何设置编译安装模式的开机自启动. 第一种方法: 1.编写red ...
- Windows下nginx设置开机自启动
第一步:下载 WinSW https://github.com/winsw/winsw/releases/download/v2.10.3/WinSW.NET4.exe 64位系统 https://g ...
- Centos7下配置Redis开机自启动
最近在做作业的时候需要用到Redis缓存,由于每次重启服务器都需要重新启动Redis,也是忒烦人,于是就有了这一篇博客,好,废话不多说. 只有两个步骤: 设置redis.conf中daemonize为 ...
- 设置开机自启动VirtualBox虚拟机系统
如果常用VirtualBox虚拟机系统的话,设置个随开机启动也是很方便的.不需要打开VirtualBox窗口,直接就是系统启动了. 又继续上网搜索学习了.(设置开机自启动VirtualBox虚拟机系统 ...
- CentOS7设置开机自启动方式
方式一: # 在/etc/rc.d/rc.local文件中追加启动命令,该文件追加后,会随着机器自动后,自动运行文件中的命令 # vim /etc/rc.d/rc.local # 权限问题:在cent ...
- Linux服务器,服务管理--systemctl命令详解,设置开机自启动
Linux服务器,服务管理--systemctl命令详解,设置开机自启动 syetemclt就是service和chkconfig这两个命令的整合,在CentOS 7就开始被使用了. 摘要: syst ...
- Ubuntu14.04设置开机自启动脚本
方法一.编辑rc.loacl脚本 Ubuntu开机之后会执行/etc/rc.local文件中的脚本,所以我们可以直接在/etc/rc.local中添加启动脚本.在 exit 0 前面添加好脚本代码, ...
- linux下配置tomcat开机自启动
Linux下配置tomcat开机自启动 1.写一个tomcat脚本,内容如下,设置其权限为755,放在/etc/init.d/目录下 #!/bin/bash## /etc/init.d/tomca ...
- linux系统下tomcat应用开机自启动 配置
linux系统下tomcat应用开机自启动 配置 相对简单的方式是将tomcat添加为系统服务第一步 复制文件将 $Tomcat_Home/bin目录下的 catalina.sh脚本文件复制到目录/ ...
随机推荐
- Zookeeper笔记(二)Paxos算法与Zookeeper的工作原理
Zookeeper 分布式服务框架是 Apache Hadoop 的一个子项目, 它主要是用来解决分布式应用中经常遇到的一些数据管理问题,如:统一命名服务.状态同步服务.集群管理.分布式应用配置项的管 ...
- 转:CentOS下后台运行Python脚本及关闭脚本的一些操作
自己写了一个python脚本,但是直接远程用putty连接后#python xxx.py执行,关闭putty脚本也随之关闭了,这里需要用到‘setsid’这个命令. #setsid python xx ...
- 【Java】 剑指offer(55-1) 二叉树的深度
本文参考自<剑指offer>一书,代码采用Java语言. 更多:<剑指Offer>Java实现合集 题目 输入一棵二叉树的根结点,求该树的深度.从根结点到叶结点依次经过 ...
- 010 处理模型数据(ModelAndView,Map Model,@SessionAttributes)
1.处理数据模型 SpringMVC提供了几种途径出书模型数据 二:ModelAndView 1.介绍 2.index <%@ page language="java" co ...
- Linux 内核编译问题
linux0.12 编译过程 https://www.bbsmax.com/A/GBJrMb0Kz0/ http://www.cnblogs.com/strugglesometimes/p/42313 ...
- hdu1576(扩展欧几里得)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1576 题目:要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能 ...
- VB 获取文件版本
Function GetVer(FilePathName As String) As String If FilePathName = Nothing Or FilePathName = " ...
- Web大前端面试题-Day9
1. 请用至少3中方式实现数组去重? 方法一: indexOfvar arr1=[1,2,3,4,5,4,3,2,1]; function repeat1(arr){ for(var i=0, ...
- POJ.2774.Long Long Message/SPOJ.1811.LCS(后缀数组 倍增)
题目链接 POJ2774 SPOJ1811 LCS - Longest Common Substring 比后缀自动机慢好多(废话→_→). \(Description\) 求两个字符串最长公共子串 ...
- bzoj 4737: 组合数问题
Description 组合数C(n,m)表示的是从n个物品中选出m个物品的方案数.举个例子,从(1,2,3)三个物品中选择两个物品可以有( 1,2),(1,3),(2,3)这三种选择方法.根据组合数 ...