具体的安装步骤网上有很多人说明在此我不在多说,只是把他们的方法拿过来,本文具体说一说我在安装oracle 遇到的问题。需要特别注意的地方,我会标红,字体放大。

 

系统版本 Cnet OS 64 位

Oracle版本 :11g 64 位

 

要说明一下:如果系统位数和Oracle位数不一样在安装的时候会出现问题,所以在安装之前要确定,系统和Oracle版本相对应,以免出现不必要的问题。

 

我找的网上比较好的安装步骤:

1. 安装前准备

[1] 安装软件包

yum -y install binutils compat-libcap1 compat-libstdc++.i686 compat-libstdc++.x86_64 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64 ksh libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 libXext libXtst libX11 libXau libxcb libXi make sysstat unixODBC-devel.i686 unixODBC-devel.x86_64 unixODBC.i686 unixODBC.x86_64 compat-libstdc++-33.i686 compat-libstdc++-33.x86_64

 

这里要特别注意一下,下面这个包一定要手动安装不然后面会出现问题。在安装这个包的时候会出现冲突,手动卸载有冲突的包就行了。

 

安装软件包 pdksh-5.2.14-36.el5.i386.rpm (这个包yum源里没有,所以要手动安装,不装安装oracle时会有警告出现,但不影响最后的使用)

请下载这个包上传到CentOS后使用如下命令安装。(单击文件名称下载)

[root@localhost public_root]# rpm -ivh pdksh-5.2.14-36.el5.i386.rpm

[2] 更改kernel参数

[root@localhost var]# vi /etc/sysctl.conf

# Disable netfilter on bridges.
#net.bridge.bridge-nf-call-ip6tables = 0
#net.bridge.bridge-nf-call-iptables = 0
#net.bridge.bridge-nf-call-arptables = 0
# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536

# Controls the maximum size of a message, in bytes
kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes
kernel.shmmax = 4294967295

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 268435456

# 在文件末尾添加
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@localhost var]# sysctl -p

[3] 创建安装oracle所需用户与用户组

[root@localhost var]# groupadd -g 200 oinstall
[root@localhost var]# groupadd -g 201 dba
[root@localhost var]# useradd -u 440 -g oinstall -G dba -d /usr/oracle oracle
[root@localhost var]# passwd oracle

[root@localhost var]# vi /etc/pam.d/login
#%PAM-1.0
auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so
auth       include      system-auth
account    required     pam_nologin.so
account    include      system-auth
password   include      system-auth
# pam_selinux.so close should be the first session rule
session    required     pam_selinux.so close
session    required     pam_loginuid.so
session    optional     pam_console.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session    required     pam_selinux.so open
session    required     pam_namespace.so
session    required     pam_limits.so
session    optional     pam_keyinit.so force revoke
session    include      system-auth
-session   optional     pam_ck_connector.so

[root@localhost var]# vi /etc/security/limits.conf

# 在文件末尾添加
oracle   soft   nproc   2047
oracle   hard   nproc   16384
oracle   soft   nofile   1024
oracle   hard   nofile   65536

[root@localhost var]# vi /etc/profile

# 在文件末尾添加
if [ $USER = "oracle" ]; then
      if [ $SHELL = "/bin/ksh" ]; then
           ulimit -p 16384
           ulimit -n 65536
      else
           ulimit -u 16384 -n 65536
      fi
fi

[4] 切换到oracle用户,并进行配置

CentOS7合集 centos7 ll_libstdc++

[root@localhost ~]# su - oracle
[oracle@localhost ~]$ chmod 755 /usr/oracle
[oracle@localhost ~]$ mkdir /usr/oracle/app
[oracle@localhost ~]$ chmod 755 /usr/oracle/app/
[oracle@localhost ~]$ mkdir /usr/oracle/oradata
[oracle@localhost ~]$ chmod 755 /usr/oracle/oradata/
[oracle@localhost ~]$ vi ./.bash_profile

# 在文件末尾添加
umask 022
export ORACLE_BASE=/usr/oracle/app

2. 安装oracle database

[1] 下载oracle安装文件(for linux x86),并上传到CentOS上

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

[2] 解压安装文件

[root@localhost public_root]# unzip linux_11gR2_database_1of2.zip
[root@localhost public_root]# unzip linux_11gR2_database_2of2.zip

[3] 以oracle用户登陆,startx命令启动图形界面,打开一个终端窗口,进行到刚刚解压database的文件夹,运行以下命令

 

 

 

在执行上面的步骤以前在执行上面步骤以前可能还需要在管理员权限下执行 xhost + 命令,主要是为了能通过前期检查,可以出现图形化界面。这个问题不是每个人都会遇到。

还有一种问题:是在运行上面步骤之前可以需要执行 export LANG=en_US 这个可能不需要,主要原因是在出现图像化界面的时候可能会出现乱码。这个问题也是不是每个人都能遇到

[oracle@localhost database]$ ./runInstaller

[4] oracle安装界面启动如下图所示,输入邮件地址及密码(oracle用户),以从oralce接收安全更新等信息

CentOS7合集 centos7 ll_oracle_02

[5] 仅安装数据库软体

CentOS7合集 centos7 ll_linux_03

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

CentOS7合集 centos7 ll_libstdc++_04

[7] 选择语言

CentOS7合集 centos7 ll_libstdc++_05

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

CentOS7合集 centos7 ll_linux_06

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

CentOS7合集 centos7 ll_oracle_07

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

CentOS7合集 centos7 ll_CentOS7合集_08

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

CentOS7合集 centos7 ll_linux_09

[12] 接下来,oralce安装程序会对安装环境进行检查,本例未检查到任何问题,显示安装信息如下。直接Finish, 开始安装。

在出现下面这个界面的时候可能会出现一些package没有安装 或者missing,出现这种情况有两种原因

1、这个package你确实没有安装,解决方法就是安装一个

2、这个你确定已经安装了,但是是x86_64版本的,提示是缺少i386版本的,这个时候你可以直接忽略掉,直接进入下一步。

 

CentOS7合集 centos7 ll_oracle_10

[13] 静待oracle安装

CentOS7合集 centos7 ll_CentOS7合集_11

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

CentOS7合集 centos7 ll_CentOS7合集_12

[root@localhost ~]# /usr/oracle/oraInventory/orainstRoot.sh
Changing permissions of /usr/oracle/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /usr/oracle/oraInventory to oinstall.
The execution of the script is complete.
[root@localhost ~]# /usr/oracle/app/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=  /usr/oracle/app/product/11.2.0/dbhome_1

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

CentOS7合集 centos7 ll_CentOS7合集_13

[16] 环境变量配置

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

# 文件末尾增加
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin

这个时候你的Oracle可能已经安装成功了,你想知道有没有安装成功:

所以你执行了lsnrctl start命令但是提示说这是个未知的命令可以执行下面的命令

进入主目录执行下面的命令:

cd /

su - root

su - oracle

这样可能就进去了。

当你重新启动系统的时候你可能会发现出现下面的问题。