关于我们

质量为本、客户为根、勇于拼搏、务实创新

< 返回新闻公共列表

云服务器CentOS如何安装Oracle数据库

发布时间:2022/10/20 20:44:37
香港云服务器

这里推荐使用otk脚本安装oracle,会大大提高安装oracle的成功系数。

description
oratoolkit is the swiss army knife for oracle. standards and well designed tools help dba's mastering oracle 10g / 11g throughout the whole lifecycle. otk runs on linux, zlinux, solaris, aix, hp-ux and other unix based systems.

一,安装oracle约束
1、内存要求

最小内存1g,推荐2g或2g以上

2、swap大小设定

1gb跟2gb物理内存之间的,设定swap大小为物理内存的1.5倍

2gb跟16gb物理内存之间的,设置swap大小与物理内存相等

16gb物理内存以上的,设置swap大小为16gb

3、共享内存/dev/shm要求

至少比在每个oracle实例中的memory_max_target和memory_target要大。

4、/tmp空间大小要求

至少1gb空间

5、硬盘大小要求

存放oracle软件文件和数据文件的空间至少10gb

6、操作系统

centos 6.5 64bit
- basic server

二,安装步骤
1. 安装oracle需要的文件:

linux.x64_11gr2_database_1of2.zip
linux.x64_11gr2_database_2of2.zip
oratoolkit-1.0.2.1.5-1.noarch.rpm
下载这三个文件,放在/media/oracle目录下。

2. 安装otk

root用户登录

把oratoolkit-1.0.2.1.5-1.noarch.rpm安装包移动到yum本地数据源文件夹/media/packages下

在packages下执行安装命令

# yum -y install oratoolkit*

3. 修改oracle用户密码

otk已经帮我们建立了oracle用户,下面需要设置oracle用户密码
# passwd oracle

4. 检查环境依赖关系工具swreqcheck

otk提供了智能检查环境依赖关系,即检查linux系统还有什么不满足的条件,比如缺少安装包。

# /opt/oracle/otk/current/bin/installmanager swreqcheck ossetup11gr2.cfg..

..

..

20140419_010832: info: action swreqcheck of installmanager ended with 44 warnings

我的系统安装的是centos 6.5 64bit - basic server,新系统缺少的安装包较多,检查出44个warnings。

其中43个缺少的安装包,一个可忽略的warning:

# 20140419_011022: warning: oracle software runs on centos however this combination is not supported by oracle

安装必须安装的安装包:用一个shell脚本来解决问题,otk提供了必须安装的安装包清单。

#先拼装命令 req_file_dir="/opt/oracle/otk/current/conf/installmanager/requirement"req_file_path="$req_file_dir/ora11gr2-redhat-5-x86_64.pkg.lst"yum_command=$(echo "yum -y install")

yum_command+=$(egrep -v "#" $req_file_path | grep 32-bit | awk '{ print " "$1".i[356]86" }') 

yum_command+=$(egrep -v "#" $req_file_path | grep 64-bit | awk '{ print " "$1".x86_64" }')#用echo看看最终拼装的命令是什么样 echo $yum_command#执行命令 $yum_command#再次执行环境检查 /opt/oracle/otk/current/bin/installmanager swreqcheck ossetup11gr2.cfg

再次检查结果:

# 20130521_170131: info: action swreqcheck of installmanager with one warning

剩下一个可忽略的警告。说明环境已经满足oracle安装了。

5. 编译安装rlwrap(增强sqlplus功能)

rlwrap is a wrapper that uses the gnu readline library to allow the editing of keyboard input for any other command. input history is kept between invocations, separately for each command; history completion and search work as in bash and completion word lists can be specified on the command line.
来自 

otk集成了rlwrap工具

rlwrap增强了sqlplus的执行命令历史记录和自动完成功能

编译安装rlwrap

# cd /opt/oracle/otk/current/tools/rlwrap/# ./configure# make# make install# rlwrap -v

rlwrap 0.30

6. 使用otk工具installmanager安装ossetup

on the one hand it does what is required from oracle documentation and on the other hand it setups also the environment for otk. the next bullet list shows a summary.
来自  # /opt/oracle/otk/current/bin/installmanager ossetup ossetup11gr2.cfg

7. 把oracle安装文件移入资源目录

otk默认读取oracle安装文件的目录是/var/opt/oracle/repository;

otk的swinst实例安装命令会读取这个目录:

# cd /media/oracle# chown oracle:oinstall *# mv linux.x64_11gr2_database_1of2.zip linux.x64_11gr2_database_2of2.zip /var/opt/oracle/repository/

8. 登录oracle用户,修改配置文件

# su - oracle------------------------------------------------------oratoolkit environment variables------------------------------------------------------installation directory : /opt/oracle/otkrelease : 1.0.2.1.5$run directory : /opt/oracle/otk/1.0/bin$log_base directory : /var/opt/oracle/otk/1.0/log------------------------------------------------------# vi .profile.custom.interactive

修改文件中的site值。

9. 安装oracle数据库

otk是用swinst安装数据库的,swinst的工作原理:

the main purpose of swinst action is to execute oui in silent mode in order to install the software. however, before it can be executed it is required to unzip the file containing the software. otk starts here and takes care also about the extraction before launching runinstaller script.
来自 

用一个shell脚本来安装数据库:

#bash# /opt/oracle/otk/1.0/conf/installmanager 配置文件路径cd $install_conf# 拷贝oracle11gr2配置文件,step1,2,3cp sample/swinsteesrv11gr2-step[123]-linux-x86_64.cfg .# swinst 引导安装installmanager swinst swinsteesrv11gr2-step1-linux-x86_64.cfg

installmanager