全网整合营销服务商

电脑端+手机端+微信端=数据同步管理

免费咨询热线:400-708-3566

centos 6.5下安装oracle 11gR2与Oracle自动启动的配置

注意:以下命令使用 root 用户操作

安装依赖包

主要思路为配置 oracle yum 仓库,直接使用 yum 命令来安装依赖包,避免手工逐个的安装依赖包。

配置 yum 仓库以下载 orcale 依赖包

注意:这里是CentOS 6.X 的 oracle 依赖仓库,其他版本不同的。

导入 GPG Keys

wget https://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle --no-check-certificate

安装 oracle 依赖

yum install oracle-rdbms-server-11gR2-preinstall

设置 hostname

打开文件 /etc/sysconfig/network,并修改 HOSTNAME。

vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=oracle.buzheng.org

打开 /etc/host, 添加服务器本机IP地址 指向到 HOSTNAME

vi /etc/hosts
192.168.1.15 oracle.buzheng.org oracle

oracle 用户设置

当安装好 oracle 依赖之后, oracle 用户已经创建好了,不需要手工创建 oracle 用户和相关的用户组。

修改 oracle 用户密码

[root@oracle ~]# passwd oracle
更改用户 oracle 的密码 。
新的 密码:
重新输入新的 密码:
passwd: 所有的身份验证令牌已经成功更新。

修改系统限制

在文件 /etc/security/limits.d/90-nproc.conf 中添加如下的最后一行

[root@oracle ~]# vi /etc/security/limits.d/90-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
*   soft nproc  1024
root  soft nproc  unlimited
*   -  nproc  16384

修改 SELinux 为 permissive 模式

修改文件 /etc/selinux/config 如下所示

[root@oracle ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#  enforcing - SELinux security policy is enforced.
#  permissive - SELinux prints warnings instead of enforcing.
#  disabled - No SELinux policy is loaded.
SELINUX=permissive
# SELINUXTYPE= can take one of these two values:
#  targeted - Targeted processes are protected,
#  mls - Multi Level Security protection.
SELINUXTYPE=targeted

重启机器

[root@oracle]# reboot

创建 oracle 安装目录,并授权

[root@oracle]# mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1
[root@oracle]# chown -R oracle:oinstall /u01
[root@oracle]# chmod -R 775 /u01

授权 oracle 用户能够访问 X Server

[root@oracle]# xhost + # 要在主机上运行,不能是远程 shell

注意:以下命令使用 oracle 用户操作

配置 oracle 安装环境变量

切换到 oracle 用户, 编辑 .bash_profile 文件, 如下所示, 添加环境配置。

[root@oracle]# su oracle
[oracle@oracle]# vi .bash_profile
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=oracle.buzheng.org; export ORACLE_HOSTNAME
ORACLE_UNQNAME=orcl; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH export PATH

下载 oracle 安装文件,解压缩后安装

下载 oracle

打开 oracle 下载页面,http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html , 下载下面两个文件到 /home/oracle

linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip

解压缩文件并运行

unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
cd database
./runInstaller

若为中文系统,安装界面会出现中文乱码,需要先将环境变为英文,在安装

export LANG=en_US
./runInstaller

没有截图, 安装步骤大致包括以下几步:

  1. Create and configure a database
  2. Server Class
  3. Single instance database installation
  4. Advanced install
  5. Language: English
  6. Enterprise Edition
  7. database type: General Purpose / Transaction Processing
  8. Memory: Enable Automatic Memory Management
  9. Character sets: Use Unicode(AL32UTF8)

图性界面安装最后会提示以ROOT 执行下面两个脚本

[root@oracle ~]# /u01/app/oraInventory/orainstRoot.sh 
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@oracle ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh 
Running Oracle 11g root.sh script...
The following environment variables are set as:
 ORACLE_OWNER= oracle
 ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1
Enter the full pathname of the local bin directory: [/usr/local/bin]: 
 Copying dbhome to /usr/local/bin ...
 Copying oraenv to /usr/local/bin ...
 Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.

出现的问题

1, 当环境变量中的 ORACLE_SID 与 安装时实际配置不一致时,会导致 startup 出错,出错信息如下:

ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initDB11G.ora'

2, 如果远程客户端连接是报错:ora-12514 tns 监听程序当前无法识别连接描述符中请求的服务,则需要配置 listener.ora,添加如下节点:

SID_LIST_LISTENER = 
 (SID_LIST= 
 (SID_DESC =
  (SID_NAME = orcl)
  (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
 )
 )

好了,到此已经安装完成,通过访问 web 管理界面可验证。下面步骤也很重要,请继续。

注意:以下命令使用 root 用户操作

配置防火墙规则,开放侦听端口

将 1521(你配置的 oracle 侦听端口) 端口添加到防火墙规则,以便远程用户能顺利的访问到 oracle 服务。

iptables -I INPUT 4 -m state --state NEW -p tcp --dport 1521 -j ACCEPT
service iptables save
service iptables reload

设置 oracle 自动启动

完成 oracle 安装后,我们可以通过命令启动停止数据库,但是当机器重启时并不能随机器启动,这也给我们带来了一些不便,下面记录了,如何将 oralce 加入服务中,并随机机器启动。

修改配置文件 /etc/oratab

修改 /etc/oratab 的最后一行的最后一个字符,将 N 修改为 Y。此举主要是为了使 oracle 的 dbstart 命令能在系统启动时能运行。如下所示:

[root@oracle ~]# vi /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:/u01/app/oracle/product/11.2.0/dbhome_1:Y

创建 /etc/init.d/oracle

在 /etc/init.d/下创建文件 oracle,此为 oracle 自启动脚本。内容如下:

#!/bin/sh
# chkconfig: 345 61 61
# description: Oracle 11g R2 AutoRun Servimces
# /etc/init.d/oracle
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface
ORACLE_HOME="/u01/app/oracle/product/11.2.0/dbhome_1"
ORA_OWNR="oracle"
# if the executables do not exist -- display error
if [ ! -f "$ORACLE_HOME/bin/dbstart" ]
then
echo "Oracle startup: cannot start"
exit 1
fi
# parameter: start, stop, restart
case "$1" in
start)
# Oracle listener and instance startup
su $ORA_OWNR -s /bin/bash $ORACLE_HOME/bin/dbstart $ORACLE_HOME
echo "Oracle Start Succesful!OK."
;;
stop)
# Oracle listener and instance shutdown
su $ORA_OWNR -s /bin/bash $ORACLE_HOME/bin/dbshut $ORACLE_HOME
echo "Oracle Stop Succesful!OK."
;;
restart)
$0 stop
$0 start
;;
*)
echo $"Usage: `basename $0` {start|stop|restart}"
exit 1
esac
exit 0

赋予启动脚本执行权限并链接好:

# chmod 750 /etc/init.d/oracle
# ln -s /etc/init.d/oracle /etc/rc1.d/K61oracle
# ln -s /etc/init.d/oracle /etc/rc3.d/S61oracle

启动脚本设置好了之后,可以使用 service 命令来启动停止 oracle 了,这时候 oracle 已经是系统服务了。

service oracle start
service oracle stop
service oracle restart

设置 oracle 服务为自启动

# chkconfig --add oracle
# chkconfig --level 345 oracle on

总结

好了,重启机器试试吧。以上就是这篇文章的全部内容了,希望本文的内容对大家学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流。


# centos  # 6  # oracle11gr2  # centos安装oracle11g  # linux  # oracle自动启动  # centos7下安装oracle11gR2的详细步骤  # Linux下安装Oracle(CentOS-Oracle 12c)的方法  # CentOS命令行下装oracle 12c的方法(命令行模式安装)  # CentOS系统上安装配置Oracle数据库的详细教程  # CentOS下PHP安装Oracle扩展  # CentOS6.2上安装Oracle10g报ins_emdb.mk错误处理方法  # CentOS 6.3下安装部署Oracle服务器图文教程  # Linux+php+apache+oracle环境搭建之CentOS下安装Oracle数据库  # Linux+php+apache+oracle环境搭建之CentOS下源码编译安装PHP  # centos下Oracle11G图文安装教程  # 好了  # 所示  # 重启  # 解压缩  # 不需要  # 令牌  # 给我们  # 要在  # 能在  # 我们可以  # 这也  # 带来了  # 英文  # 可以使用  # 这篇文章  # 几步  # 并不能  # 报错  # 后会  # 到此 


相关文章: 佛山企业网站制作公司有哪些,沟通100网上服务官网?  建站之星展会模板:智能建站与自助搭建高效解决方案  如何在橙子建站上传落地页?操作指南详解  建站之星2.7模板快速切换与批量管理功能操作指南  盐城做公司网站,江苏电子版退休证办理流程?  公司网站制作需要多少钱,找人做公司网站需要多少钱?  小型网站建站如何选择虚拟主机?  如何通过远程VPS快速搭建个人网站?  ,制作一个手机app网站要多少钱?  制作网站的过程怎么写,用凡科建站如何制作自己的网站?  建站之星如何快速解决建站难题?  如何用狗爹虚拟主机快速搭建网站?  如何快速搭建高效简练网站?  浙江网站制作公司有哪些,浙江栢塑信息技术有限公司定制网站做的怎么样?  香港服务器如何优化才能显著提升网站加载速度?  如何选择长沙网站建站模板?H5响应式与品牌定制哪个更优?  建站上传速度慢?如何优化加速网站加载效率?  如何高效利用200m空间完成建站?  成都品牌网站制作公司,成都营业执照年报网上怎么办理?  高端企业智能建站程序:SEO优化与响应式模板定制开发  如何选择网络建站服务器?高效建站必看指南  香港服务器部署网站为何提示未备案?  c# 在ASP.NET Core中管理和取消后台任务  油猴 教程,油猴搜脚本为什么会网页无法显示?  建站之星手机一键生成:多端自适应+小程序开发快速建站指南  如何在搬瓦工VPS快速搭建网站?  山东云建站价格为何差异显著?  如何在自有机房高效搭建专业网站?  网站制作专业公司有哪些,如何制作一个企业网站,建设网站的基本步骤有哪些?  Android自定义控件实现温度旋转按钮效果  美食网站链接制作教程视频,哪个教做美食的网站比较专业点?  详解jQuery中基本的动画方法  最好的网站制作公司,网购哪个网站口碑最好,推荐几个?谢谢?  建站之星如何实现五合一智能建站与营销推广?  5种Android数据存储方式汇总  制作网站软件推荐手机版,如何制作属于自己的手机网站app应用?  三星网站视频制作教程下载,三星w23网页如何全屏?  如何快速查询网站的真实建站时间?  兔展官网 在线制作,怎样制作微信请帖?  制作网站的基本流程,设计网站的软件是什么?  北京制作网站的公司,北京铁路集团官方网站?  如何通过NAT技术实现内网高效建站?  平台云上自主建站:模板化设计与智能工具打造高效网站  如何在IIS管理器中快速创建并配置网站?  建站之星价格显示格式升级,你的预算足够吗?  如何在阿里云ECS服务器部署织梦CMS网站?  如何高效搭建专业期货交易平台网站?  php8.4新语法match怎么用_php8.4match表达式替代switch【方法】  建站之星后台密码遗忘如何找回?  宠物网站制作html代码,有没有专门介绍宠物如何养的网站啊? 

您的项目需求

*请认真填写需求信息,我们会在24小时内与您取得联系。