如何简化Oracle Linux上安装Oracle Database

对于广大Oracle数据库技术爱好者来讲,在虚拟机上安装部署学习Oracle数据库无疑是一个不错的选择,我们既可以按照自己的需求进行系统的配置,也可以在很短的时间内搭建出需要的运行环境,既保证了实用性,也满足了高效性,而Linux平台则更是广大技术爱好者的首选实验环境平台。

在Linux平台上,通常在运行./runInstaller图形界面安装Oracle Database时,我们需要先做一些准备工作,比如安装必备的RPM包,修改系统内核参数,创建必要的用户和用户组,这些操作本身没有什么难度,因为我们可以按照Oracle文档说明去完成些操作,最多是多花一点时间。本文将介绍一种新的方法,可以让你省去这些繁琐的准备工作,使在Linux 平台上安装Oracle Database变的更加快捷和方便。

由于之前Oracle发布的linux平台版本的数据库产品主要面向于RedHat,但在RedHat上安装部署Oracle 数据库经常会出现一些问题,加之Linux开源及Oracle公司势力日益扩增,因此Oracle公司最终对外宣布推出了自己的Linux系统(Oracle Linux),虽然Oracle公司推出了自己的Linux系统,但事实上Oracle公司是拿RedHat Linux做内核,仅将RedHat图标改为Oracle,将之前在RedHat Linux上运行Oracle数据库出现的问题和Bug修复,最多也就增强了一些功能而已。本文就是介绍在Oracle Linux上如何简化安装Oracle Database,因为该方法只支持Oracle Linux版本,对于Oracle Linux系统的安装在此不作说明,下面直接从安装完系统开始安装Oracle数据库前演示。

由于数据库需要某些软件包、软件包版本以及内核参数微调,在系统上安装Oracle Database 10g或11g之前,需要预先配置操作环境。在Oracle Linux上,有一种非常轻松的办法可以让系统满足这些安装先决条件,安装一个名为oracle-validated的RPM软件包,该RPM包可以帮你自动完成Oracle数据库所必须的RPM包的安装,修改系统内核参数,创建必要的用户和用户组等。此RPM执行以下预配置步骤:
1)促使下载和安装数据库安装所需的各种软件包和特定版本,通过yum或up2date功能来解析软件包依赖项;
2)创建用户oracle和组oinstall及dba,这些将在数据库安装期间使用;
3)修改/etc/sysctl.conf中的内核参数以更改共享内存、信号、最大文件描述符数量等设置;
4)设置/etc/security/limits.conf中的软硬shell资源限制,如锁定内存地址空间、打开的文件数量、进程数和核心文件大小;
5)针对x86_64计算机,在内核中设置numa=off;

请注意oracle-validated只是根据数据库安装的需要来分析现有的/etc/sysctl.conf 和/etc/security/limits.conf文件并更新值,所有与数据库安装无关的预自定义设置保持不变,oracle-validated RPM软件包可通过Oracle Unbreakable Linux Network(ULN需要支持合同)、Oracle Linux 发行介质或Oracle公共yum信息库获取。因此,无论系统是否在ULN注册访问Oracle补丁和支持,您均可使用 oracle-validated来简化Oracle Linux上的数据库安装,不过要记住,Oracle公共yum信息库不会更新安全更新和错误修补,因此保持最新和安全的系统的最佳方式是使用ULN订阅。

安装oracle-validated.rpm
  首先,设置一个yum配置文件,让其指向正确的信息库,然后从该信息库安装oracle-validated RPM,使用yum安装oracle-validated RPM包,主要是为了解决安装该包的依赖关系。为了简化操作,我直接将Oracle Linux系统安装光盘挂载在/mnt目录下,作为信息库,以下是针对Oracle Database安装使用oracle-validated对系统进行预配置的步骤:
1.作为一个授权用户(如 root)检索配置信息库位置的文件:

[root@11gR2 ~]# cd /etc/yum.repos.d/
[root@11gR2 yum.repos.d]#

2.在该目录下创建一个后缀为.repo任意名文件,其内容如下:

[ol5_u8_base]
name=Jialin.Lee Oracle Linux 5.8
baseurl=file:///mnt/Server/
gpgcheck=0
enabled=1

3.使用yum install命令安装oracle-validated RPM
注:清单1中的输出显示了安装过程如何检查依赖项然后下载和安装所需软件包 

[root@11gR2 yum.repos.d]# yum install oracle-validated*.rpm
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
oel-base | 1.1 kB 00:00
oel-base/primary | 1.4 MB 00:00
oel-base 3298/3298
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package oracle-validated.x86_64 0:1.1.0-15.el5 set to be updated
oel-base/filelists | 3.1 MB 00:00
--> Processing Dependency: sysstat for package: oracle-validated
--> Processing Dependency: /usr/lib/libaio.so for package: oracle-validated
--> Processing Dependency: glibc-headers for package: oracle-validated
--> Processing Dependency: elfutils-libelf-devel for package: oracle-validated
--> Processing Dependency: unixODBC-devel for package: oracle-validated
--> Processing Dependency: /usr/lib64/libodbccr.so for package: oracle-validated
--> Processing Dependency: gcc-c++ for package: oracle-validated
--> Processing Dependency: libaio-devel for package: oracle-validated
--> Processing Dependency: gcc for package: oracle-validated
--> Processing Dependency: /usr/lib/gcc/x86_64-redhat-linux/4.1.1/libstdc++.a for package: oracle-validated
--> Processing Dependency: /usr/lib/libodbc.so.1 for package: oracle-validated
--> Processing Dependency: /usr/lib/libc.so for package: oracle-validated
--> Processing Dependency: /usr/lib64/libaio.so for package: oracle-validated
--> Processing Dependency: /usr/lib64/libc.so for package: oracle-validated
--> Processing Dependency: /usr/lib/libodbccr.so for package: oracle-validated
--> Processing Dependency: libXp.so.6 for package: oracle-validated
--> Processing Dependency: libodbc.so.1()(64bit) for package: oracle-validated
--> Running transaction check
---> Package elfutils-libelf-devel.x86_64 0:0.137-3.el5 set to be updated
--> Processing Dependency: elfutils-libelf-devel-static-x86_64 = 0.137-3.el5 for package: elfutils-libelf-devel
---> Package gcc.x86_64 0:4.1.2-52.el5 set to be updated
---> Package gcc-c++.x86_64 0:4.1.2-52.el5 set to be updated
---> Package glibc-devel.i386 0:2.5-81 set to be updated
---> Package glibc-devel.x86_64 0:2.5-81 set to be updated
---> Package glibc-headers.x86_64 0:2.5-81 set to be updated
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers
--> Processing Dependency: kernel-headers for package: glibc-headers
---> Package libXp.i386 0:1.0.0-8.1.el5 set to be updated
---> Package libaio-devel.i386 0:0.3.106-5 set to be updated
---> Package libaio-devel.x86_64 0:0.3.106-5 set to be updated
---> Package libstdc++-devel.x86_64 0:4.1.2-52.el5 set to be updated
---> Package sysstat.x86_64 0:7.0.2-11.el5 set to be updated
---> Package unixODBC-devel.i386 0:2.2.11-10.el5 set to be updated
--> Processing Dependency: unixODBC = 2.2.11-10.el5 for package: unixODBC-devel
---> Package unixODBC-devel.x86_64 0:2.2.11-10.el5 set to be updated
---> Package unixODBC-libs.i386 0:2.2.11-10.el5 set to be updated
---> Package unixODBC-libs.x86_64 0:2.2.11-10.el5 set to be updated
--> Running transaction check
---> Package elfutils-libelf-devel-static.x86_64 0:0.137-3.el5 set to be updated
---> Package kernel-headers.x86_64 0:2.6.18-308.el5 set to be updated
---> Package unixODBC.x86_64 0:2.2.11-10.el5 set to be updated
--> Finished Dependency Resolution
  
Dependencies Resolved
  
===========================================================================================
Package Arch Version Repository Size
===========================================================================================
Installing:
oracle-validated x86_64 1.1.0-15.el5 oel-base 24 k
Installing for dependencies:
elfutils-libelf-devel x86_64 0.137-3.el5 oel-base 24 k
elfutils-libelf-devel-static x86_64 0.137-3.el5 oel-base 64 k
gcc x86_64 4.1.2-52.el5 oel-base 5.3 M
gcc-c++ x86_64 4.1.2-52.el5 oel-base 3.8 M
glibc-devel i386 2.5-81 oel-base 2.0 M
glibc-devel x86_64 2.5-81 oel-base 2.4 M
glibc-headers x86_64 2.5-81 oel-base 596 k
kernel-headers x86_64 2.6.18-308.el5 oel-base 1.4 M
libXp i386 1.0.0-8.1.el5 oel-base 22 k
libaio-devel i386 0.3.106-5 oel-base 12 k
libaio-devel x86_64 0.3.106-5 oel-base 11 k
libstdc++-devel x86_64 4.1.2-52.el5 oel-base 2.8 M
sysstat x86_64 7.0.2-11.el5 oel-base 187 k
unixODBC x86_64 2.2.11-10.el5 oel-base 291 k
unixODBC-devel i386 2.2.11-10.el5 oel-base 738 k
unixODBC-devel x86_64 2.2.11-10.el5 oel-base 793 k
unixODBC-libs i386 2.2.11-10.el5 oel-base 551 k
unixODBC-libs x86_64 2.2.11-10.el5 oel-base 554 k
  
Transaction Summary
===========================================================================================
Install 19 Package(s)
Upgrade 0 Package(s)
  
Total download size: 21 M
Is this ok [y/N]: y
Downloading Packages:
-------------------------------------------------------------------------------------------
Total 1.5 GB/s | 21 MB 00:00
Running RPM_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : unixODBC-libs 1/19
Installing : unixODBC 2/19
Installing : libstdc++-devel 3/19
Installing : sysstat 4/19
Installing : unixODBC-devel 5/19
Installing : kernel-headers 6/19
Installing : glibc-headers 7/19
Installing : glibc-devel 8/19
Installing : glibc-devel 9/19
Installing : libaio-devel 10/19
Installing : libaio-devel 11/19
Installing : unixODBC-libs 12/19
Installing : libXp 13/19
Installing : gcc 14/19
Installing : gcc-c++ 15/19
Installing : unixODBC-devel 16/19
Installing : elfutils-libelf-devel 17/19
Installing : oracle-validated 18/19
Installing : elfutils-libelf-devel-static 19/19
  
Installed:
oracle-validated.x86_64 0:1.1.0-15.el5
  
Dependency Installed:
elfutils-libelf-devel.x86_64 0:0.137-3.el5
elfutils-libelf-devel-static.x86_64 0:0.137-3.el5
gcc.x86_64 0:4.1.2-52.el5
gcc-c++.x86_64 0:4.1.2-52.el5
glibc-devel.i386 0:2.5-81
glibc-devel.x86_64 0:2.5-81
glibc-headers.x86_64 0:2.5-81
kernel-headers.x86_64 0:2.6.18-308.el5
libXp.i386 0:1.0.0-8.1.el5
libaio-devel.i386 0:0.3.106-5
libaio-devel.x86_64 0:0.3.106-5
libstdc++-devel.x86_64 0:4.1.2-52.el5
sysstat.x86_64 0:7.0.2-11.el5
unixODBC.x86_64 0:2.2.11-10.el5
unixODBC-devel.i386 0:2.2.11-10.el5
unixODBC-devel.x86_64 0:2.2.11-10.el5
unixODBC-libs.i386 0:2.2.11-10.el5
unixODBC-libs.x86_64 0:2.2.11-10.el5
  
Complete!

注:yum安装过程在/var/log/oracle-validated/results/orakernel.log文件中记录有关内核更改的消息,并在 /var/log/oracle-validated/backup目录中备份当前系统设置。

至此系统已准备好,可以安装Oracle Database了,举例来说,若要安装Oracle Database 11g第2版,请按照“适用于Linux的数据库安装指南”的第4章“安装 Oracle Database”中的说明进行操作。在运行./runInstaller起图形界面安装Oracle数据软件时会执行一些检查,验证是否已经安装必要的操作系统软件包和版本,此外还检查通过oracle-validated安装设置的内核参数。在内核设置检查期间,安装程序可能将一些设置标志为“failed”,您应对这些失败进行分析,在有些情况下,您仍可以继续数据库安装。如果您检查/etc/sysctl.conf中的内核设置,将发现oracle-validated为Oracle Database 10g推荐的设置不同于Oracle Database 11g,如果需要,您可以(以root身份)编辑/etc/sysctl.conf文件来手动指定设置。Oracle Universal Installer还会执行其他检查,如验证glibc版本、磁盘空间是否足够、环境变量和路径设置,以及物理内存和交换空间是否足够,一般来说,安装oracle-validated可解决先决条件,因此您可以直接继续安装数据库。

安装oracle-validated.rpm可以节省在Oracle Linux上安装Oracle Database 10g或11g的时间,RPM 能让系统满足Oracle Database安装的大多数先决条件,从而简化了安装过程。

PS: 这篇文章来源于笔者曾经新浪博客…

如何简化Oracle Linux上安装Oracle Database》上有1条评论

发表评论

电子邮件地址不会被公开。

您可以使用这些HTML标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>