温馨提示×

温馨提示×

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

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

CentOS如何安装Oracle数据库

发布时间:2022-10-20 16:39:15 来源:亿速云 阅读:154 作者:iii 栏目:建站服务器

今天小编给大家分享一下CentOS如何安装Oracle数据库的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一下吧。

这里推荐使用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.
来自 <http://utopia.knoware.nl/~hlub/uck/rlwrap/>

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.
来自 <https://www.oratoolkit.ch/tutorials/gettingstartedv.php> 
# /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/otk

release : 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.
来自 <https://www.oratoolkit.ch/tutorials/gettingstartedvii.php>

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

#bash

# /opt/oracle/otk/1.0/conf/installmanager 配置文件路径

cd $install_conf

# 拷贝oracle11gr2配置文件,step1,2,3

cp sample/swinsteesrv11gr2-step[123]-linux-x86_64.cfg .

# swinst 引导安装

installmanager swinst swinsteesrv11gr2-step1-linux-x86_64.cfg

installmanager swinst swinsteesrv11gr2-step2-linux-x86_64.cfg

installmanager swinst swinsteesrv11gr2-step3-linux-x86_64.cfg

稍等片刻,最后输出如下信息:说明安装成功。
----------------------------------------------------------------------------------------------------

20140419_132032: info: executing libinstallmanager.printinfomsg function

check in the logs if there are commands to be executed manually.
-usually /opt/oracle/sesrv/11.1.0/db1/cfgtoollogs/configtoolallcommands contains such commands
-usually /opt/oracle/sesrv/11.1.0/db1/root.sh with root privileges has to be executed in case appctl framework is not used.
-usually /opt/oracle/sesrv/11.1.0/db1/install/changeperm.sh needs to be executed when other os users requires oracle libraries
----------------------------------------------------------------------------------------------------
20140419_132032: info: action swinst of installmanager ended successfully
----------------------------------------------------------------------------------------------------

完成剩余配置,执行root.sh命令,安装最后需要手工执行剩余的脚本:

# su -
# /opt/oracle/eesrv/11.2.0/db1/root.sh
# exit

10. 创建数据库实例

otk采用dbsetup来创建实例

# cd $install_conf
# ls -l dbsetup*.cfg
dbsetup-dev.cfg 
dbsetup-prod.cfg
dbsetup-test.cfg

我安装的是开发模式(dev),我们还看到测试模式(test)和生产模式(prod);

修改dbsetup-dev.cfg配置文件,必须修改的配置为:

oracle_home的值:

$oracle_base/sesrv/11.1.0/db1

修改为:

$oracle_base/eesrv/11.2.0/db1

执行安装命令:

# installmanager dbsetup dbsetup-dev.cfg

接下来会看到在安装数据库实例,大约十几分钟,最后看到如下输出:

---------------------------------------------------------------------------------------------------- 

20130419_013000: info: executing libmiscellaneous.getfooter function 

20130419_013000: info: terminating installmanager execution 

20130419_013000: info: summary log file: /var/opt/oracle/otk/1.0/log-old/installmanager/../installmanager.log 

20130419_013000: info: detailed log file: /var/opt/oracle/otk/1.0/log-old/installmanager/dbsetup-20130522_012901.log 

20130419_013000: info: action dbsetup of installmanager ended successfully 

----------------------------------------------------------------------------------------------------

congratulations! 数据库可以使用了。

11. 登录sqlplus

# su - oracle

------------------------------------------------------ 

oracle database environment variables

------------------------------------------------------ 

$oracle_home : /opt/oracle/eesrv/11.2.0/db1

$oracle_sid : dev

$tns_admin : /opt/oracle/network

------------------------------------------------------

------------------------------------------------------

oratoolkit environment variables

------------------------------------------------------

installation directory : /opt/oracle/otk

release : 1.0.2.1.5

$run directory : /opt/oracle/otk/1.0/bin

$log_base directory : /var/opt/oracle/otk/1.0/log

------------------------------------------------------

# sqlplus / as sysdba

sql*plus: release 11.2.0.1.0 production on sat apr 19 11:27:47 2014

copyright (c) 1982, 2009, oracle. all rights reserved.

connected to:

oracle database 11g enterprise edition release 11.2.0.1.0 - 64bit production

with the partitioning, olap, data mining and real application testing options

sql>

查看数据库有哪些用户

sql>select username from dba_users;

username

------------------------------

system

sys

otk

oracle_ocm

dbsnmp

dip

outln

exfsys

perfstat

appqossys

haprobe

11 rows selected.

说明sqlplus可以使用了。

12. 使用ctl管理数据库

otk提供了一个通用的oracle数据库管理工具,它代替了oracle的appctl框架。

$ ctl status all //查看当前状态

# ctl start all //启动数据库

$ ctl stop all //停止数据库

以上就是“CentOS如何安装Oracle数据库”这篇文章的所有内容,感谢各位的阅读!相信大家阅读完这篇文章都有很大的收获,小编每天都会为大家更新不同的知识,如果还想学习更多的知识,请关注亿速云行业资讯频道。

向AI问一下细节

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

AI