如何在Linux中设置开机自动启动oracle对于LINUX操作系统有很多技术知识是我们需要学习的 。这里我就给大家介绍Linux中设置oracle开机自动启动的方法。一起来看看吧 。
Linux中设置oracle开机自动启动的方法
在terminal中切换到root用户
查看/etc/oratab文件的内容,其内容如下
[root@golonglee ~]# cat /etc/oratab | grep -v ^$
#
# 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::
#
# 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.
#
#
oel63:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N
使用命令vi /etc/oratab编辑文件/etc/oratab,在最后添加如下内容
##### what I have written is as following
oel63:/home/oracle/app/oracle/product/11.2.0/dbhome_1:Y
#####Finished wrote in 2015-12-24
说明oracle如何自启动:/home/oracle/app/oracle/product/11.2.0/dbhome_1为oracle的安装目录,要根据实际情况进行修改 。
(注意oracle如何自启动:图中我用红色标记的N要改成Y)
找到最后的内容
oel63:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N
复制该行oel63:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N并注释掉
粘贴该行 , 并将该行
oel63:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N最后的N
改为Y
最后按2次ESC键,并输入:wq并按下enter保存,退出
使用命令vi /etc/rc.d/rc.local编辑rc.local文件,添加如下内容
##### what I have written is as following
su oracle -lc "/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"
su oracle -lc /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart
#####Finished wrote in 2015-12-24
说明:因为第一行命令中有空格所以用双引号(英文的双引号)
/home/oracle/app/oracle/product/11.2.0/dbhome_1为oracle的安装目录,要根据实际情况进行修改 。
最后按2次ESC键,并输入:wq并按下enter保存 , 退出,重启机器,验证成功 。
是不是很简单呢~快跟着我一起学习吧!!!如果觉得这篇文章不错的话就给我点一个赞吧 。
讲解linux环境下Oracle的自动启动与停止修改Oracle系统配置文件/etc/oratab
/etc/oratab 格式为 SID:ORACLE_HOME:AUTO
把AUTO域设置为Y(大写) 只有这样 oracle 自带oracle如何自启动的dbstart和dbshut才能够发挥作用 oracle如何自启动我oracle如何自启动的为
ora i:/home/oracle/ora/products/ :Y
编写服务脚本
如下
#!/bin/bash
#
#################FUNCTION#############
#
# AutoStart Oracle and listener
# AutoStop Oracle and listener
#
#####################################
#
# Created by ZhouYS
#
case $ in
start)
echo Starting Oracle Databases
echo/var/log/oracle
date%T %a %D : Starting Oracle Databasee as part of system up/var/log/oracle
echo/var/log/oracle
su oracle c dbstart/var/log/oracle
echo Done
echo Starting Oracle Listeners
echo/var/log/oracle
date%T %a %D : Starting Oracle Listeners as part of system up/var/log/oracle
echo/var/log/oracle
su oracle c lsnrctl start/var/log/oracle
echo Done
echo
echo/var/log/oracle
date%T %a %D : Finished/var/log/oracle
echo/var/log/oracle
touch /var/lock/subsys/oracle
;;
stop)
echo Stoping Oracle Listeners
echo/var/log/oracle
date%T %a %D : Stoping Oracle Listener as part of system down/var/log/oracle
echo/var/log/oracle
su oracle c lsnrctl stop/var/log/oracle
echo Done
rm f /var/lock/subsys/oracle
echo Stoping Oracle Databases
echo/var/log/oracle
date%T %a %D : Stoping Oracle Databases as part of system down/var/log/oracle
echo/var/log/oracle
su oracle c dbshut /var/log/oracle
echo Done
echo
echo/var/log/oracle
date%T %a %D : Finished/var/log/oracle
echo/var/log/oracle
;;
restart)
$ stop
$ start
;;
*)
echo Usage: oracle {start|stop|restart}
exit
esac
将脚本命名为oracle 保存在/etc/rc d/init d下
改变文件属性 chmod oracle
注意 在windows下编辑此文件时有DOS格式字符导致在linux下不能够正常运行 建议用gedit 或用 vi编辑
建立服务连接
系统启动时启动数据库 oracle如何自启动我们需要以下连结∶
$ ln s /init d/oracle /etc/rc d/rc d/S oracle
$ ln s /init d/oracle /etc/rc d/rc d/S oracle
$ ln s /init d/oracle /etc/rc d/rc d/S oracle #rc d unused
要在重新启动时停止数据库 oracle如何自启动我们需要以下连结∶
$ ln s /init d/oracle /etc/rc d/rc d/K oracle # 停止
lishixinzhi/Article/program/Oracle/201311/17142
oracle开机自启动1) 建立用户,组,目录
[root@node1 ~]# id oracle
id: oracle: No such user
[root@node1 ~]# groupadd -g 54321 oinstall
[root@node1 ~]# groupadd -g 54322 dba
[root@node1 ~]# useradd -u 54321 -g oinstall -G dba oracle
[root@node1 ~]# passwd oracle
Changing password for user oracle.
New password:
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@node1 ~]# mkdir -p /u01/app/oracle
[root@node1 ~]# chown -R oracle:oinstall /u01/
2) 环境变量
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=ora11g
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
LANG=C
3) Cat /etc/sysctl.conf
kernel.shmmax = 4294967295
kernel.shmall = 2097152
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default=1048576
net.core.rmem_max=4194304
net.core.wmem_default=262144
net.core.wmem_max=1048576
fs.aio-max-nr=1048576
4) oracle 开机自启
[root@node1 ~]# cp /etc/init.d/network /etc/init.d/oracle
[root@node1 ~]# vim /etc/init.d/oracle
[root@node1 ~]# chmodx /etc/init.d/oracle
[root@node1 ~]# chkconfig oracle on
[root@node1 ~]# cat /etc/init.d/oracle
[oracle@node1 auto_backup]$ cat /etc/init.d/oracle
#! /bin/bash#
chkconfig: 2345 10 90
#
Source function library.
. /etc/init.d/functions
# See how we were called.
case "$1" in
start)
su - oracle -c "/home/oracle/startdb11g"
;;
stop)
su - oracle -c "/home/oracle/stopdb11g"
;;
*)
echo #34;Usage: $0 {start|stop}"
exit 2
esac
exit $rc
[oracle@node1 auto_backup]$ chkconfig oracle on
【oracle如何自启动 oracle数据库开机自启】关于oracle如何自启动和oracle数据库开机自启的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。
推荐阅读
- 虚拟机help,虚拟机和云手机的区别
- 包含阿亚格曼干村如何利用新媒体的词条
- 摩根盛通呀经济游戏网络,摩根盛通靠什么挣钱
- oracle怎么遍历时间 oracle遍历的sql
- ubuntu14.10安装mysql,ubuntu1410安装后不能进入桌面
- 虚拟主机怎么安装插件软件,虚拟主机装系统
- 堡垒前线手机直播怎么看,堡垒前线能联机吗
- java商城源代码 java 商城源代码
- 苹果手机断网怎么处理数据,苹果手机断网了怎么办