Linux+php+apache+oracle环境搭建之CentOS下安装Oracle数据库
作者:hebedich 发布时间:2023-10-08 01:02:56
这里推荐使用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.
来自 <http://sourceforge.net/projects/oratoolkit/?source=navbar>
一,安装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 //停止数据库


猜你喜欢
- 我就废话不多说了,直接上代码吧!import pandas as pdimport numpy as npimport matplotlib
- 一、很多读者Python安装完成之后,想要下载相关的包,例如:numpy、pandas等Python中这些基础的包,但是,发现pip根本用不
- 关于书写习惯,遵循曾经总结过的风格标准,现在一点都没有变。并且近来翻看高手作品,横向连排似乎在大产品项目中逐渐成为主流,个人认为如此维护效率
- 本文介绍基于Python语言,将一个Excel表格文件中的数据导入到Python中,并将其通过字典格式来存储的方法~ &a
- 前言在数据分析领域,最热门的莫过于Python和R语言,本文将详细给大家介绍关于Python利用pandas查询数据的相关内容,分享出来供大
- 关于非对称加密算法我就不过多介绍了,本文着重于python3对RSA算法的实现。from Crypto.PublicKey import R
- Python进程池是Python标准库中multiprocessing模块提供的一种用于管理进程的方式。它可以使Python程序以并行的方式
- 如下所示:import numpynew_list = [i for i in range(9)]numpy.array(new_list)
- 一.怎样删除一个表中某个字段重复的列呀,举个例子 表[table1] id name 1 &nb
- 批量修改: EXEC sp_MSforeachtable 'exec sp_changeob
- 在上一讲代码的基础上,做进一步修改,成为了如下程序,请看官研习这个程序:#!/usr/bin/env python#coding:utf-8
- 一、引言在编写调试Python代码过程中,我们经常需要记录日志,通常我们会采用python自带的内置标准库logging,但是使用该库,配置
- 前言Python 的一大优点就是丰富的类库,所以我们经常会用 pip 来安装各种库,所以对于Python开发用户来讲,PIP安装软件包是家常
- 前言本文主要给大家介绍的是关于python对配置文件.ini增删改查操作的相关内容,分享出来供大家参考学习,下面话不多说了,来一起看看详细的
- 前言go mod tidy的作用是把项目所需要的依赖添加到go.mod,并删除go.mod中,没有被项目使用的依赖。Tidy makes s
- 函数 0. 显示当前时间命令:select now()。作用: 显示当前时间。应用场景: 创建时间,修改时间等默认值。例子:mys
- 在windows平台上使用pyhton编写语音识别程序需要用到speech模块,speech模块支持的主要功能有:文本合成语音,将键盘输入的
- wordcloud是Python扩展库中一种将词语用图片表达出来的一种形式,通过词云生成的图片,我们可以更加直观的看出某篇文章的故事梗概。首
- 工程结构views.pydef home(request): TutorialList = ["HTML",
- JS 控制文本框只能输入数字<input onkeyup="value=value.replace(/[^0-9]/g,