服务器之家:专注于服务器技术及软件下载分享
分类导航

Linux|Centos|Ubuntu|系统进程|Fedora|注册表|Bios|Solaris|Windows7|Windows10|Windows11|windows server|

服务器之家 - 服务器系统 - Centos - centos 6.5 oracle开机自启动的环境配置详解

centos 6.5 oracle开机自启动的环境配置详解

2021-12-20 16:59小_马 Centos

这篇文章主要介绍了centos 6.5 oracle开机自启动的环境配置详解的相关资料,需要的朋友可以参考下

centos 6.5 oracle开机自启动的环境配置详解

环境:centos 6.5 + oracle 11g

自启动之前问题

虚拟机里的oracle环境,每次重启完系统,用plsql developer连接,先是报错:

无tns监听程序

解决方法是切换到系统的oracle用户,执行lsnrctl start,但是执行之前,因为oracle_home环境变量没有生效,还要是环境变量文件生效,步骤如下:

?
1
2
3
4
5
6
[oracle@localhost ~]$ source .bash_profile
 
[oracle@localhost ~]$ echo $oracle_home
/home/oracle/app/oracle/product/11.2.0/dbhome_1
 
[oracle@localhost ~]$ lsnrctl start

启动完成后,再次连接,又报错:

centos 6.5 oracle开机自启动的环境配置详解

oracle没有启动。启动步骤如下:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[oracle@localhost ~]$ sqlplus /nolog
 
sql*plus: release 11.2.0.1.0 production on wed oct 19 14:29:10 2016
 
copyright (c) 1982, 2009, oracle. all rights reserved.
 
sql> conn / as sysdba
connected to an idle instance.
sql> startup
oracle instance started.
 
total system global area 776646656 bytes
fixed size         2217384 bytes
variable size       490736216 bytes
database buffers     281018368 bytes
redo buffers        2674688 bytes
database mounted.
database opened.

配置自启动

下面把上述过程都配置成开机启动。

环境变量生效

可能是因为我的oracle用户不是桌面登录的,是从终端su切换过来的,.bash_profile文件没有运行。我把文件里的内容写入.bashrc文件后,重启就可以了。

tns监听以及oracle服务自启动

编辑: /etc/oratab文件,把最后一行的n改成y

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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:/home/oracle/app/product/11.2.0/dbhome_1:y

路径可能不同

编辑 /etc/rc.local 文件,增加 最后两行:

?
1
2
3
4
5
6
7
8
9
10
11
#!/bin/sh
#
# this script will be executed *after* all the other init scripts.
# you can put your own initialization stuff in here if you don't
# want to do the full sys v style init stuff.
 
touch /var/lock/subsys/local
service smb restart
su - oracle -c 'lsnrctl start'
su - oracle -c 'dbstart'
su - oracle -c 'emctl start dbconsole'

dbstart是数据库自带的启动脚本,我们只要加到rc.local中让它开机调用就可以了。但是还需要编辑一下它。修改dbstart的oracle_home_listner,使其指向$oracle_home:

?
1
2
# first argument is used to bring up oraclenet listener
oracle_home_listner=$oracle_home

重启虚拟机,发现plsql developer可以直接连接上了。

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

原文链接:http://blog.csdn.net/pony_maggie/article/details/52874667

延伸 · 阅读

精彩推荐
  • Centos使用Xshell连接Centos 6.6服务器操作图文教程

    使用Xshell连接Centos 6.6服务器操作图文教程

    这篇文章主要介绍了使用Xshell连接Centos 6.6服务器操作图文教程,本文用详细的操作步骤讲解了如何使用Xshell连接Centos服务器,需要的朋友可以参考下 ...

    脚本之家4032019-09-18
  • CentosCentOS系统下软件包的制作方法和过程详解

    CentOS系统下软件包的制作方法和过程详解

    今天小编将为大家带来的是CentOS系统下软件包的制作方法和过程详解;希望对大家会有帮助,有需要的朋友一起去看看吧...

    CentOS之家4802019-05-30
  • CentosCentOS 最新版本git的安装教程

    CentOS 最新版本git的安装教程

    本文主要给大家介绍了CentOS 最新版本git的安装教程,非常不错,具有参考借鉴价值,感兴趣的朋友一起看看吧...

    CentOS教程网9252021-11-29
  • Centos在CentOS系统上安装Docker的教程

    在CentOS系统上安装Docker的教程

    这篇文章主要介绍了在CentOS系统上安装Docker的教程,Docker是当下人气最为火热的容器类虚拟软件,需要的朋友可以参考下 ...

    开源中文社区3952019-09-17
  • Centoscentos 7中添加一个新用户并授权的步骤详解

    centos 7中添加一个新用户并授权的步骤详解

    这篇文章主要给大家介绍了关于在centos 7中添加一个新用户并授权的步骤,文中将实现的步骤介绍的非常详细,通过文中介绍的步骤可以轻松的创建一个新...

    Ryan.Miao9832022-02-12
  • CentosCentOS6.2网卡设置

    CentOS6.2网卡设置

    如果你想让服务器可以更新、让网友访问你的LINUX服务器,那一定要设置LINUX网上给网卡绑定一个IP,下面我们就介绍CentOS6.2网卡设置IP的方法。...

    CentOS教程网10092021-10-03
  • CentosCentOS7 阿里云的yum源使用详解

    CentOS7 阿里云的yum源使用详解

    这篇文章主要介绍了CentOS7 阿里云的yum源使用详解的相关资料,这里对备份yum源,添加EPEL源,和缓存清理,进行了介绍,需要的朋友可以参考下...

    天王9312020-12-28
  • CentosCentOS上SVN服务器端程序的安装与使用教程

    CentOS上SVN服务器端程序的安装与使用教程

    SVN是一款高人气的软件项目版本控制系统,由于其在Windows的客户端的简易操作,在Git的浪潮中仍然保有很多的用户数量,这里我们就来看一下CentOS上SVN服务器端...

    cnblogs3902019-07-16