CentOS 6.4下安装Oracle 11gR2(x64)

安装前须知:

  1. 内存(RAM)的最小要求是 1GB,建议 2GB 及以上。
  2. 虚拟内存 swap 建议:内存为 1GB~2GB 时建议swap大小为内存大小的 1.5 倍;内存为 2GB~16GB 时建议swap大小为内存的大小;内存超过 16GB 时swap保持16GB。
  3. 要求临时文件目录,如 /tmp 的磁盘空间至少 1GB。
  4. 磁盘空间要求:企业版为4.35GB的安装空间和1.7GB以上的数据文件空间;标准版为4.22GB的安装空间和1.5GB以上的数据文件空间。
  5. 须要 X window 图形界面。
  6. 须要 root 用户权限

本文安装环境:

  1. 操做系统 CentOS 6.4 2.6.32-358.el6.x86_64(desktop),2GB RAM,80GB 硬盘空间(4GB swap、100MB /boot、40GB /)
  2. 主机名 mophee, IP 192.168.80.19(静态)
  3. 环境:VMware Workstation 9.0

安装所需程序包(在root账号下操做):

1linux

2c++

3数据库

4centos

5浏览器

6bash

7session

8oracle

9ide

10ui

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

binutils-2.17.50.0.6

compat-libstdc++-33-3.2.3

compat-libstdc++-33-3.2.3 (32 bit)

elfutils-libelf-0.125

elfutils-libelf-devel-0.125

gcc-4.1.2

gcc-c++-4.1.2

glibc-2.5-24

glibc-2.5-24 (32 bit)

glibc-common-2.5

glibc-devel-2.5

glibc-devel-2.5 (32 bit)

glibc-headers-2.5

ksh-20060214

libaio-0.3.106

libaio-0.3.106 (32 bit)

libaio-devel-0.3.106

libaio-devel-0.3.106 (32 bit)

libgcc-4.1.2

libgcc-4.1.2 (32 bit)

libstdc++-4.1.2

libstdc++-4.1.2 (32 bit)

libstdc++-devel 4.1.2

make-3.81

sysstat-7.0.2

unixODBC-2.2.14-11.el6 (x86_64) or later

unixODBC-2.2.14-11.el6.i686 or later

unixODBC-devel-2.2.14-11.el6 (x86_64) or later

unixODBC-devel-2.2.14-11.el6.i686 or later

libXp

使用命令 yum list | grep ‘package name’ 或者 rpm -q ‘package name’ 或者 rpm -qa | grep ‘package name’ 查看程序包是否已经安装。 使用命令 yum install -y ‘package name’ 安装所缺的程序包,pdksh包除外。注意:要用yum安装32 bit的程序包,可先修改 vi /etc/yum.conf,添加一行:multilib_policy=all。oracle在检查环境的时候会要求安装i386,但CentOS 6.4光盘中32 bit的程序包都是i686,其实都同样,忽略这个差别问题应该不大(见下边的安装部分)。

1

yum install -y binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel make numactl sysstat libXp unixODBC unixODBC-devel

安装pdksh包(该程序包未被归入CentOS的安装盘中):

使用命令:wget ftp://rpmfind.net/linux/centos/5.9/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_64.rpm 将pdksh程序包下载到本地

使用命令 rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm 进行安装(注意:该程序包与ksh冲突,若是已经安装ksh,建议使用命令 rpm -e ksh-* 卸载)

建立所需的用户组(在root账号下操做):

1

2

3

groupadd oinstall;

groupadd dba;

groupadd oper;

建立所需的账号(在root账号下操做):

使用命令 id oracle; 查看 oracle 账号是否已存在,若未存在则使用以下命令进行建立

1

2

useradd -g oinstall -G dba,oper oracle; #初始群组为 oinstall,有效群组为 dba、oper

passwd oracle; #为oracle账号设置密码(安装的时候须要登陆)

若oracle账号已存在,则使用命令 usermod -a -G dba,oper oracle 将其加入群组 dba 和 oper中

修改内核参数(在root账号下操做):

编辑内核参数配置文件 vi /etc/sysctl.conf,在该文件下修改或添加以下行:

1

2

3

4

5

6

7

8

9

10

11

fs.file-max = 6815744

fs.aio-max-nr=1048576

kernel.shmall = 2097152

kernel.shmmax = 2147483648

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576

再执行如下命令使以上配置当即生效:

1

sysctl -p;

修改系统资源限制(在root账号下操做):

编辑系统资源限制配置文件 vi /etc/security/limits.conf,在该文件下添加以下行:

1

2

3

4

5

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

oracle soft stack 10240

编辑文件 vi /etc/pam.d/login,添加以下行(11gR1有要求,R2没有要求):

1

session required pam_limits.so

编辑 vi /etc/profile 文件,添加以下行(11gR1有要求,R2没有要求):

1

2

3

4

5

6

7

8

if [ $USER = "oracle" ]; then

        if [ $SHELL = "/bin/ksh" ]; then

              ulimit -p 16384

              ulimit -n 65536

        else

              ulimit -u 16384 -n 65536

        fi

fi

该配置在用户oracle登陆时会当即生效,若是当前 oracle 用户已经登陆可退出后从新登陆使之生效。

关闭SELinux(在root账号下操做):

编辑SELinux配置文件 vi /etc/selinux/config,将SELINUX的值设为 disabled,以下:

1

SELINUX=disabled;

修改该文件可以使重启系统后不启动SELinux。关闭当前已开启的SELinux使用以下命令:

1

setenforce 0

修改/etc/hosts文件(在root账号下操做):

编辑文件 vi /etc/hosts,添加一行:

1

192.168.80.19 mophee

若不进行此操做会在安装时弹出警告,而且可能影响监听程序的正常运行,因此建议作这个修改。

建立所需的目录(在root账号下操做):

把oracle安装在 /opt/oracle 目录下,因此需建立该目录:

1

2

3

mkdir /opt/oracle;

chown oracle:oinstall /opt/oracle;

chmod 755 /opt/oracle;

安装时还须要设置 Inventory 目录,因此需建立该目录:

1

2

3

mkdir /opt/oraInventory;

chown oracle:oinstall /opt/oraInventory;

chmod 755 /opt/oraInventory;

安装包相关:

Oracle 11g R2的安装包被压缩成两个文件: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; 进行解压缩,将获得一个名称为 database 的目录。我把它放在 /home/oracle/database 中。

因为安装过程是以 oracle 身份进行的,因此需确保oracle账号对 /home/oracle/database 有执行权限,可以使用以下命令将该目录赋予oracle账号全部,并拥有执行权限:

1

2

chmod -R 700 /home/oracle/database;

chown -R oracle:oinstall /home/oracle/database;

————————退出 root,以 oracle 身份登陆———————————-

设置oracle账号登陆时环境(以oracle身份登陆):

编辑文件 vi /home/oracle/.bash_profile,添加以下行:

1

2

3

4

5

6

ORACLE_BASE=/opt/oracle; #安装目录

ORACLE_HOME=$ORACLE_BASE/11g; #oracle家目录

ORACLE_SID=orcl; #实例名

LD_LIBRARY_PATH=$ORACLE_HOME/lib;

PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin;

export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH;

保存退出后执行以下命令使以上设置当即生效:

1

source /home/oracle/.bash_profile

开始安装(以oracle身份登陆):

1

2

export LANG=en_US; ##

/home/oracle/database/runInstaller; ##执行该程序开始安装

如下将进入图形安装界面

001-centos64-install-oracle-database-step1of9
图-1 输入email,点击next

002-centos64-install-oracle-database-step1of9
图-2 因为个人安装机没连通外网,因此提示我设置代理。选中复选框,点击Continue

003-centos64-install-oracle-database-step2of9
图-3 选中第一项,在安装完成时建立并简单配置数据库,点击next

004-centos64-install-oracle-database-step3of8
图-4 选中Server Class,点击next

005-centos64-install-oracle-database-step4of10
图-5 以单例模式安装(若安装RAC,选择下一项),点击next

006-centos64-install-oracle-database-step5of10
图-6 选中Advanced install,点击next

007-centos64-install-oracle-database-step6of13
图-7 安装语言,能够从左侧选择简体中文,点击next

008-centos64-install-oracle-database-step7of13
图-8 选择安装企业版,点击next

009-centos64-install-oracle-database-step8of13
图-9 安装基目录和Home目录,因为咱们已设置好环境变量ORACLE_BASE和ORACLE_HOME,此处无需再选择,点击next

010-centos64-install-oracle-database-step9of13
图-10 以oinstall群组身份进行安装,点击next

011-centos64-install-oracle-database-step10of21
图-11 安装用于事务处理的数据库(数据仓库选中下一项),点击next

012-centos64-install-oracle-database-step11of21
图-12 因为咱们已设置好环境变量ORACLE_SID,因此此步无需修改,点击next

013-centos64-install-oracle-database-step12of21
图-13.1 可以使用的最大内存,Oracle建议使用自动内存管理,点击选项卡Character sets选择字符集

014-centos64-install-oracle-database-step12of21
图-13.2 选择UTF-8做为数据库字符集,点击Sample Schemas顺便建立Oracle提供的案例

015-centos64-install-oracle-database-step12of21
图-13.3 选中复选框,点击next

016-centos64-install-oracle-database-step13of21
图-14 没什么好设置的(根据本身需求),点击next

017-centos64-install-oracle-database-step14of21
图-15 此步可选择数据文件的存储方式,我选了简单的文件系统,点击next

018-centos64-install-oracle-database-step15of21
图-16 是否启用自动备份,在生产环境仍是启用的好,点击next

019-centos64-install-oracle-database-step16of21
图-17 为系统管理账号设置密码,输入完后点击next

020-centos64-install-oracle-database-step17of21
图-18 选择DBA账号所属群组(可以使用conn / as sysdba登陆数据库)和oper账号所属群组,点击next

021-centos64-install-oracle-database-step18of21
图-19 安装程序对环境进行检查,因为CentOS的32bit程序包都是i686的,而oracle要求i386,因此此处会失败,忽略便可。点击next

022-centos64-install-oracle-database-step19of21
图-20 点击Finish,开始安装

023-centos64-install-oracle-database-step20of21
图-21 安装ing。。。

024-centos64-install-oracle-database-step20of21
图-22 安装ing。。。

025-centos64-install-oracle-database-step20of21
图-23 点击Password Management可设置相关管理账号的密码,因为在图-17已设过因此无需再设,点击OK

026-centos64-install-oracle-database-step20of21
图-24 保留,先执行下一步:以root身份登陆执行那两个sh文件

027-centos64-install-oracle-database-step20of21
图-25 以root身份登陆执行那两个sh文件,如上图左下角。执行完成后,点击OK,就大功告成了。

打开浏览器,输入https://localhost:1158/em,可打开Database Control管理界面,则Oracle已经开始运行了。

本文参考Oracle官方文档:Oracle® Database Quick Installation Guide 11g Release 2 (11.2) for Linux x86-64

相关文章
相关标签/搜索