温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

CentOS 7 安装 Oracle 11.2.0.4

发布时间:2020-08-07 13:36:46 来源:ITPUB博客 阅读:361 作者:sqysl 栏目:关系型数据库

本文转自: https://www.cnblogs.com/xqzt/p/5456401.html

但结合实际情况,内容稍有改动。

一、安装环境

CentOS Linux release 7.2.1511 (Core)

Oracle Database 11g Release 2 (11.2.0.4)

二、安装安准备

2.1 修改主机名

修改/etc/sysconfig/network配置文件中的HOSTNAME变量

[root@xqzt ~]# hostnamectl set-hostname oracledb

####永久性修改

[root@xqzt ~]#vi /etc/sysconfig/network

NETWORKING=yes

HOSTNAME= oracledb

[root@xqzt ~]# hostname oracledb

2.2 添加主机名与IP对应记录

[root@xqzt ~]# vi /etc/hosts 172.17.22.70 oracledb

CentOS 7 安装 Oracle 11.2.0.4

2.3 关闭Selinux

[root@oracledb ~]# sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config   [root@oracledb ~]# setenforce 0

CentOS 7 安装 Oracle 11.2.0.4

2.4 firewall开启1521端口

[root@sdba ~]# firewall-cmd --permanent --zone=public --add-port=1521/tcp  success [root@sdba ~]# firewall-cmd --reload success

CentOS 7 安装 Oracle 11.2.0.4

2.5下载 Oracle 11g

http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

2.6 检查硬件配置要求

最小内存 1 GB of RAM

虚拟内存容量

Available RAM

Swap Space Required

Between 1 GB and 2 GB

1.5 times the size of RAM

Between 2 GB and 16 GB

Equal to the size of RAM

More than 16 GB

16 GB

硬盘空间要求

数据库软件硬盘空间需求:

Installation Type

Requirement for Software Files (GB)

Enterprise Edition

3.95

Standard Edition

3.88

数据文件硬盘空间需求:

Installation Type

Requirement for Data Files (GB)

Enterprise Edition

1.7

Standard Edition

1.5

检查的命令

#内存 grep MemTotal /proc/meminfo

#交换空间 grep SwapTotal /proc/meminfo

#磁盘空间 df -ah

2.7  安装所需的软件包

通过查看Oracle安装文档中列出的Package Requirements可以查看在不同平台上需要的软件包。

packages for Oracle Linux 7

binutils-2.23.52.0.1-12.el7.x86_64

compat-libcap1-1.10-3.el7.x86_64

gcc-4.8.2-3.el7.x86_64

gcc-c++-4.8.2-3.el7.x86_64

glibc-2.17-36.el7.i686

glibc-2.17-36.el7.x86_64

glibc-devel-2.17-36.el7.i686

glibc-devel-2.17-36.el7.x86_64

ksh libaio-0.3.109-9.el7.i686 libaio-0.3.109-9.el7.x86_64

libaio-devel-0.3.109-9.el7.i686 libaio-devel-0.3.109-9.el7.x86_64

libgcc-4.8.2-3.el7.i686 libgcc-4.8.2-3.el7.x86_64

libstdc++-4.8.2-3.el7.i686 libstdc++-4.8.2-3.el7.x86_64

libstdc++-devel-4.8.2-3.el7.i686 libstdc++-devel-4.8.2-3.el7.x86_64

libXi-1.7.2-1.el7.i686 libXi-1.7.2-1.el7.x86_64

libXtst-1.2.2-1.el7.i686 libXtst-1.2.2-1.el7.x86_64

make-3.82-19.el7.x86_64 sysstat-10.1.5-1.el7.x86_64

Oracle ODBC Drivers

On Oracle Linux 6, Red Hat Enterprise Linux 6, and Asianux Server 4:

unixODBC-2.3.1-6.el7.x86_64 or later unixODBC-2.3.1-6.el7.i686 or later unixODBC-devel-2.3.1-6.el7.x86_64 or later unixODBC-devel-2.3.1-6.el7.i686 or later

CentOS 7 安装 Oracle 11.2.0.4

安装软件包

yum -y install binutils

yum -y install compat-libcap1

yum install -y gcc gcc-c++ glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64

yum install -y libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64

yum install -y libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64

yum install -y libXi.i686 libXi.x86_64 libXtst.i686 libXtst.x86_64

yum install -y make

yum install -y sysstat

yum install -y unixODBC.i686 unixODBC.x86_64 unixODBC-devel.i686 unixODBC-devel.x86_64

ksh无用  yum install -y ksh  需要安装pdksh,另外还需要安装elfutils-libelf-devel

wget -O /tmp/pdksh-5.2.14-37.el5_8.1.x86_64.rpm http://vault.centos.org/5.11/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_64.rpm cd /tmp rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm

CentOS 7 安装 Oracle 11.2.0.4

yum install -y elfutils-libelf-devel

CentOS 7 安装 Oracle 11.2.0.4

否则会提示缺少package

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

2.8创建安装oracle所需用户与用户组

root用户:创建Oracle安装组oinstall,数据库管理员组dba,及oracle用户

[root@oracledb ~]# groupadd -g 200 oinstall

CentOS 7 安装 Oracle 11.2.0.4

[root@oracledb ~]# groupadd -g 201 dba

CentOS 7 安装 Oracle 11.2.0.4

[root@oracledb ~]# useradd -u 440 -g oinstall -G dba -d /home/oracle oracle

CentOS 7 安装 Oracle 11.2.0.4

[root@oracledb ~]# passwd oracle

CentOS 7 安装 Oracle 11.2.0.4

2.9 更改kernel参数

[root@oracledb ~]# vi /etc/sysctl.conf

#末尾添加如下

net.ipv4.ip_local_port_range= 9000 65500

fs.file-max = 6815744 kernel.shmall = 10523004

kernel.shmmax = 6465333657

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.core.rmem_default=262144

net.core.wmem_default=262144

net.core.rmem_max=4194304

net.core.wmem_max=1048576

fs.aio-max-nr = 1048576

执行以下命令使更改生效

[root@oracledb ~]# sysctl -p

CentOS 7 安装 Oracle 11.2.0.4

2.10 修改系统资源限制

[root@oracledb ~]# vi /etc/security/limits.conf oracle   soft   nproc   2047 oracle   hard   nproc   16384 oracle   soft   nofile   1024 oracle   hard   nofile   65536

CentOS 7 安装 Oracle 11.2.0.4

[root@oracledb ~]# vi /etc/profile

CentOS 7 安装 Oracle 11.2.0.4

if [ $USER = "oracle" ]; then           if [ $SHELL = "/bin/ksh" ]; then                   ulimit -p 16384                    ulimit -n 65536           else                     ulimit -u 16384 -n 65536           fi fi

CentOS 7 安装 Oracle 11.2.0.4

[root@oracledb ~]# vi /etc/pam.d/login   #下面添加一条pam_limits.so      session    required    pam_limits.so

CentOS 7 安装 Oracle 11.2.0.4

2.11 创建安装目录及设置权限

创建如下的目录

[oracle@oracledb /]$ tree /u01/ /u01/ └── oracle     ├── app     └── oradata

CentOS 7 安装 Oracle 11.2.0.4

root创建

[root@oracledb ~]# mkdir –p /u01/oracle [root@oracledb ~]# chown –R oracle:oinstall  /u01

CentOS 7 安装 Oracle 11.2.0.4

oracle创建

[root@localhost ~]# su - oracle

[oracle@localhost ~]$ chmod 755 /u01/oracle

[oracle@localhost ~]$ mkdir /u01/oracle/app

[oracle@localhost ~]$ chmod 755 /u01/oracle/app/

[oracle@localhost ~]$ mkdir /u01/oracle/oradata

[oracle@localhost ~]$ chmod 755 /u01/oracle/oradata/

[oracle@localhost ~]$ vi ./.bash_profile

# 在文件末尾添加

umask 022

export ORACLE_BASE=/u01/oracle/app

2.12 设置oracle环境变量

[oracle@oracledb ~]$ vi ~/.bash_profile

export ORACLE_BASE=/u01/oracle/app

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1

export PATH=$PATH:$ORACLE_HOME/bin

export ORACLE_SID=orcl

[oracle@oracledb ~]$ source .bash_profile #立即生效

三、安装database
[1]上传oracle安装文件到CentOS上

windows下使用putty的pscp工具

I:\>pscp -r "oracle database 11.2.0.4" oracle@服务器IP:/u01

oracle@172.17.84.83's password:

p13390677_112040_Linux-x8 | 1362873 kB | 25714.6 kB/s | ETA: 00:00:00 | 100%

p13390677_112040_Linux-x8 | 1124320 kB | 26769.5 kB/s | ETA: 00:00:00 | 100%

p13390677_112040_Linux-x8 | 1177003 kB | 27372.2 kB/s | ETA: 00:00:00 | 100%

p13390677_112040_Linux-x8 | 640651 kB | 27854.4 kB/s | ETA: 00:00:00 | 100%

p13390677_112040_Linux-x8 | 585127 kB | 27863.2 kB/s | ETA: 00:00:00 | 100%

p13390677_112040_Linux-x8 | 476926 kB | 28054.5 kB/s | ETA: 00:00:00 | 100%

p13390677_112040_Linux-x8 | 116719 kB | 29180.0 kB/s | ETA: 00:00:00 | 100%

[2] 解压安装文件

unzip p13390677_112040_Linux-x86-64_1of7.zip

unzip p13390677_112040_Linux-x86-64_2of7.zip

unzip p13390677_112040_Linux-x86-64_3of7.zip

unzip p13390677_112040_Linux-x86-64_4of7.zip

unzip p13390677_112040_Linux-x86-64_5of7.zip

unzip p13390677_112040_Linux-x86-64_6of7.zip

unzip p13390677_112040_Linux-x86-64_7of7.zip

[3]  以oracle用户VNC 登陆,运行以下命令

安装VNC

yum install tigervnc-server

CentOS 7 安装 Oracle 11.2.0.4

开启端口

[root@oracledb ~]# firewall-cmd --permanent --zone=public --add-port=5901/tcp  success [root@oracledb ~]# firewall-cmd --reload success

CentOS 7 安装 Oracle 11.2.0.4

运行安装程序

/u01/11.2.0.4/database/runInstaller

CentOS 7 安装 Oracle 11.2.0.4

[4]输入邮件地址及密码(oracle用户),以从oralce接收安全更新等信息

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[5] 选择安装数据库软件并创建数据,也可以选择第二项仅安装数据库软件

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[6]选择服务器版本

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[7] 本实例中选择安装单实例数据库

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[8]高级模式安装

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[9] 选择语言

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[10] 选择要安装的版本,这里选择 “Enterprise Edition”

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[11] 指定Oracle Base 与 Software Location, 我们在oracle用户的profile文件里已设置此环境变量,此处保持默认

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[12] 指定Inventory Directory, 本例保持默认

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[13]选择数据库用途

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[14]数据库名及服务名

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[15]开启自动内存管理

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[16]设置默认编码为UTF8

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[17]示例方案

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[18]启用Oracle企业管理控制台OEM

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[19]选择数据库文件目录

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[20]自动备份设置

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[21]设置数据库用户名和密码[注意:密码不要以数字开头,否则后面会报错ORA-00922: 选项缺失或无效]

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[22]指定oralce特权用户组,本例保持默认

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[23] 接下来,oralce安装程序会对安装环境进行检查,

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

安装完缺少的package,重新检查

[24]显示安装信息如下。直接Finish, 开始安装。

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[25] 静待oracle安装

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[26]当出现以下窗口时,另开一个终端,以root用户登陆,并执行下面的命令。执行完毕后,点击OK

[root@oracledb oracle]# /usr/oracle/oraInventory/orainstRoot.sh

[root@oracledb oracle]# /usr/oracle/app/product/11.2.0/dbhome_1/root.sh

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[27] 至此oracle 11g R2数据库安装完毕。

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

[28] 环境变量配置

[oracle@oracledb oracle]$ vi ~/.bash_profile # 在文件末尾添加 export ORACLE_BASE=/usr/oracle/app export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 export PATH=$PATH:$ORACLE_HOME/bin export ORACLE_SID=orcl

CentOS 7 安装 Oracle 11.2.0.4

[29]开放控制台端口,

参照 CentOS 6下 Oracle11gR2 设置开机自启动

解锁scott账户方法

六、遇到的问题

问题1:交换空间太小

安装Oracle改变swap交换空间大小

安装oracle 检查交换空间太小

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

问题2:先决条件检查缺少package

Oracle 11gR2 安装少包情况

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

问题3: oracle 11g 安装及netca,dbca乱码之解决

原因:Linux上没有安装Oracle安装时使用的字体

方法一: 上传字体库

字体库下载地址  http://download.csdn.net/detail/lidongtang/4182819

然后在Linux下执行以下命令,把字体库安装到相应位置即可

mkdir  -p /usr/share/fonts/zh_CN/TrueType cp zysong.ttf /usr/share/fonts/zh_CN/TrueType/

CentOS 7 安装 Oracle 11.2.0.4

这样在安装的时候。Oracle就会提示中文了,而不再是中文乱码了。

方法二:使用英文安装

export.utf-8

CentOS 7 安装 Oracle 11.2.0.4

或者

# vi /etc/sysconfig/i18n(不会出现乱码)

CentOS 7 安装 Oracle 11.2.0.4

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

问题4:无法使用命令 /usr/bin/xdpyinfo 自动检查显示器颜色

参照  无法使用命令 /usr/bin/xdpyinfo 自动检查显示器颜色。请检查是否设置了 DISPLAY 变量。 未通过 <<<<

解决办法: 不用root登陆,直接用oracle用户登陆系统

CentOS 7 安装 Oracle 11.2.0.4 CentOS 7 安装 Oracle 11.2.0.4

问题4:无法使用命令 /usr/bin/xdpyinfo 自动检查显示器颜色

参照  无法使用命令 /usr/bin/xdpyinfo 自动检查显示器颜色。请检查是否设置了 DISPLAY 变量。 未通过 <<<<

Exception  String: Error in invoking target 'agent nmhs' of makefile  '/u01/oracle/app/oracle/product/11.2.0/dbhome/sysman/lib/ins_emagent.mk'. 

google了一下,好像是oracle新版的bug,如下解决:
解决方案: 保留安装过程,另外开启一个终端窗口,将ins_emagent.mk文件中的$(MK_EMAGENT_NMECTL)更改为$(MK_EMAGENT_NMECTL) -lnnz11,然后在安装过程中点击Retry即可。
sed  -i  's/^\(\s*\$(MK_EMAGENT_NMECTL)\)\s*$/\1 -lnnz11/g'  /u01/app/oracle/product/11.2.0/dbhome_1/sysman/lib/ins_emagent.mk

参考:

Oracle 11g 联机文档:Linux安装向导

CentOS 6安装Oracle 11gR2数据库

Linux上Oracle 11g安装步骤图解

CentOS 6.5_x64安装Oracle 11g R2

Oracle 与 iptables 和 SELinux 禁用关系说明

CenotOS6中文环境下安装Oracle 11g 中文乱码 解决办法

oracle 11.2.0.4 Error in invoking target 'agent nmhs' ins_emagent.mk

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI