分类: Oracle
2011-08-18 17:41:28
最近闲来无事,在REDHAT AS 5企业版上安装了一个ORACLE 10G,在网上下了个文档,按照其步骤,安装
成功,觉得该文档很不错,所以收藏,原文来自:
http://blog.sina.com.cn/s/blog_3f2ef1180100bsuv.html
一、安装 RHEL5.2
这部分没有特殊需要介绍的,基本上Step by Step即可,并且之后如果有需要也可以在后面进行配置
或者安装其他包。
二、针对 Oracle 配置 RHEL5.2
需要检查安装 Oracle 10g 所需的所有程序包和更新以及对系统进行配置,以便具备相应的环境。
2.1 RHEL5.2 内核版本(root)
检查RHEL5.2内核版本:
[root@RHEL ~]# uname -r
2.6.18-92.el5xen
2.2 Oracle 10g 所需程序包(root)
检查Oracle 10g安装所需要的内核版本:
[root@RHEL ~]# rpm -q gcc make binutils openmotif
gcc-4.1.2-42.el5
make-3.81-3.el5
binutils-2.17.50.0.6-6.el5
openmotif is not installed
查询其他包安装情况:
[root@RHEL ~]# rpm -q gcc make binutils openmotif setarch compat-db compat-gcc \
> compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel
gcc-4.1.2-42.el5
make-3.81-3.el5
binutils-2.17.50.0.6-6.el5
openmotif-2.3.0-0.5.el5
setarch-2.0-1.1
compat-db-4.2.52-5.1
package compat-gcc is not installed
package compat-gcc-c++ is not installed
package compat-libstdc++ is not installed
package compat-libstdc++-devel is not installed
那么安装之。这些包在RHEL的DVD安装盘上的server目录下都有,只要找到安装即可。
[root@RHEL ~]# cd "/media/RHEL_5.2 i386 DVD/Server"
[root@RHEL Server]# rpm -Uvh setarch-2*
warning: setarch-2.0-1.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
package setarch-2.0-1.1 is already installed
[root@RHEL Server]# rpm -Uvh setarch-2*
warning: setarch-2.0-1.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
package setarch-2.0-1.1 is already installed
[root@RHEL Server]# rpm -Uvh make-3*
warning: make-3.81-3.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
package make-3.81-3.el5 is already installed
[root@RHEL Server]# rpm -Uvh glibc-2*
warning: glibc-2.5-24.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
warning: package glibc = 2.5-24 was already added, skipping glibc < 2.5-24
error: error reading from file glibc-2.5-24.i686.rpm
[root@RHEL Server]# rpm -Uvh libaio-0*
warning: libaio-0.3.106-3.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
package libaio-0.3.106-3.2 is already installed
[root@RHEL Server]# rpm -Uvh compat-libstdc++-33-3*
warning: compat-libstdc++-33-3.2.3-61.i386.rpm: Header V3 DSA signature: NOKEY, key ID
37017186
Preparing... ########################################### [100%]
package compat-libstdc++-33-3.2.3-61 is already installed
[root@RHEL Server]# rpm -Uvh compat-gcc-34-3*
warning: compat-gcc-34-3.4.6-4.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:compat-gcc-34 ########################################### [100%]
[root@RHEL Server]# rpm -Uvh compat-gcc-34-c++-3*
warning: compat-gcc-34-c++-3.4.6-4.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:compat-gcc-34-c++ ########################################### [100%]
[root@RHEL Server]# rpm -Uvh gcc-4*
warning: gcc-4.1.2-42.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
package gcc-4.1.2-42.el5 is already installed
[root@RHEL Server]# rpm -Uvh libXp-1*
warning: libXp-1.0.0-8.1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:libXp ########################################### [100%]
[root@RHEL Server]# rpm -Uvh openmotif-2*
warning: openmotif-2.3.0-0.5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:openmotif ########################################### [100%]
[root@RHEL Server]# rpm -Uvh compat-db-4*
warning: compat-db-4.2.52-5.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:compat-db ########################################### [100%]
安装完成后,再次查询,可能发现如下包依然没有安装:
package compat-gcc is not installed
package compat-gcc-c++ is not installed
package compat-libstdc++ is not installed
package compat-libstdc++-devel is not installed
但是,如果再次安装的,又会提示already installed。后来也没管了,安装Oracle 10g会正常通过
。
2.3 验证系统要求(root)
[root@RHEL ~]# grep MemTotal /proc/meminfo
MemTotal: 1086464 kB
[root@RHEL ~]# grep SwapTotal /proc/meminfo
SwapTotal: 2031608 kB
所需最小 RAM 为 512MB,而所需最小交换空间为 1GB。对于 RAM 小于或等于 2GB 的系统,交换空
间应为 RAM 数量的两倍;对于 RAM 大于 2GB 的系统,交换空间应为 RAM 数量的一到两倍。Oracle 10g
软件还需要 2.5GB 的可用磁盘空间,而数据库则另需 1.2GB 的可用磁盘空间。/tmp 目录至少需要
400MB 的可用空间。要检查系统上的可用磁盘空间,运行以下命令:
[root@RHEL ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
18G 5.4G 11G 33% /
/dev/sda1 244M 14M 218M 6% /boot
tmpfs 531M 0 531M 0% /dev/shm
/dev/hdc 2.9G 2.9G 0 100% /media/RHEL_5.2 i386 DVD
以上是我虚拟机的环境,我只在虚拟机上挂了一个盘。
2.4 创建 Oracle 组和用户帐户(root)
[root@RHEL ~]# /usr/sbin/groupadd oinstall
[root@RHEL ~]# /usr/sbin/groupadd dba
[root@RHEL ~]# /usr/sbin/useradd -m -g oinstall -G dba oracle
[root@RHEL ~]# /usr/sbin/useradd -m -g oinstall -G dba oracle
[root@RHEL ~]# id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)
[root@RHEL ~]# passwd oracle
Changing password for user oracle.
New password:
Retype new password:
passwd:all authentication tokens updated successfully.
2.5 创建安装目录(root)
创建存储 Oracle 10g 软件和数据库文件的目录。在创建目录结构时所用的命名惯例符合最佳灵活结
构 (OFA) 规范。
[root@RHEL ~]# mkdir -p /usr/app/oracle/product/10.2.0/db_1
[root@RHEL ~]# mkdir -p /usr/app/oracle/product/10.2.0/oradata
[root@RHEL ~]# mkdir -p /usr/app/oracle/install
[root@RHEL ~]# chown -R oracle:oinstall /usr/app/oracle
[root@RHEL ~]# chmod -R 775 /usr/app/oracle
创建/usr/app/oracle/install目录是用作安装Oracle的位置,随便放在/mnt/Ora10G也是一样。
2.6 配置 RHEL5.2 内核参数(root)
Linux 内核非常出色。与大多数其他UNIX 系统不同,Linux 允许在系统启动和运行时修改大多数内
核参数。完成内核参数更改后不必重新启动系统。Oracle 数据库 10g 需要以下所示的内核参数设置。其
中给出的是最小值,因此如果您的系统使用的值较大,则不要更改它。。
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
具体地,是修改/etc/sysctl.conf的内容。通常,网上使用cat或者vi来编辑该文件。其实,gedit比
这些都好用多了,并且对照来看看哪些参数可以设置了,尤其是cat只是追加上去,可能会造成一个参数
有多个配置。下面是我的配置情况:
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.ipv4.ip_forward = 0
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename
# Useful for debugging multi-threaded applications
kernel.core_uses_pid = 1
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536
# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 65536
# Controls the maximum shared segment size, in bytes
# 这个值本身比推荐值大,所以保持不变
kernel.shmmax = 4294967295
# Controls the maximum number of shared memory segments, in pages
# 这个值本身比推荐值大,所以保持不变
kernel.shmall = 268435456
# For Oracle Install
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
# 这几个参数不在Oracle文档内。在Oracle安装自检时,却会检测这些参数。
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
增加的这几个参数(rmem_default、rmem_max、wmem_default、wmem_max),一开始我没设置,在
Oracle安装自检时会报警告错误。这部分提前说明,具体警报信息如下:
[oracle@RHEL oracle]$ cd /usr/app/oracle/install
[oracle@RHEL install]$ ./runInstaller
Starting Oracle Universal Installer...
Checking installer requirements...
Checking operating system version: must be redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0,
asianux-1 or asianux-2
Passed
All installer requirements met.
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2008-12-30_04-17-29PM.
Please wait ...
Checking operating system requirements ...
Expected result: One of redhat-3,redhat-4,SuSE-9,asianux-1,asianux-2
Actual Result: redhat-4
Check complete. The overall result of this check is: Passed
=======================================================================
Checking operating system package requirements ...
Checking for make-3.79; found make-1:3.81-3.el5. Passed
Checking for binutils-2.14; found binutils-2.17.50.0.6-6.el5. Passed
Checking for gcc-3.2; found gcc-4.1.2-42.el5. Passed
Checking for libaio-0.3.96; found libaio-0.3.106-3.2. Passed
Check complete. The overall result of this check is: Passed
=======================================================================
Checking kernel parameters
Checking for semmsl=250; found semmsl=250. Passed
Checking for semmns=32000; found semmns=32000. Passed
Checking for semopm=100; found semopm=100. Passed
Checking for semmni=128; found semmni=128. Passed
Checking for shmmax=536870912; found shmmax=4294967295. Passed
Checking for shmmni=4096; found shmmni=4096. Passed
Checking for shmall=2097152; found shmall=268435456. Passed
Checking for file-max=65536; found file-max=65536. Passed
Checking for VERSION=2.6.9; found VERSION=2.6.18-92.el5xen. Passed
Checking for ip_local_port_range=1024 - 65000; found ip_local_port_range=1024 - 65000.
Passed
Checking for rmem_default=262144; found rmem_default=109568. Failed <<<<
Checking for rmem_max=262144; found rmem_max=131071. Failed <<<<
Checking for wmem_default=262144; found wmem_default=109568. Failed <<<<
Checking for wmem_max=262144; found wmem_max=131071. Failed <<<<
Check complete. The overall result of this check is: Failed <<<<
Problem: The kernel parameters do not meet the minimum requirements (see above).
Recommendation: Perform operating system specific instructions to update the kernel
parameters.
=======================================================================
Checking Recommended glibc version
Expected result: ATLEAST=2.3.2-95.27
Actual Result: 2.5-24
Check complete. The overall result of this check is: Passed
=======================================================================
Checking physical memory requirements ...
Expected result: 922MB
Actual Result: 1060MB
Check complete. The overall result of this check is: Passed
=======================================================================
Checking available swap space requirements ...
Expected result: 1590MB
Actual Result: 1983MB
Check complete. The overall result of this check is: Passed
=======================================================================
Checking Network Configuration requirements ...
Check complete. The overall result of this check is: Passed
=======================================================================
Validating ORACLE_BASE location (if set) ...
Check complete. The overall result of this check is: Passed
=======================================================================
Checking Oracle Home path for spaces...
Check complete. The overall result of this check is: Passed
=======================================================================
Checking for proper system clean-up....
Check complete. The overall result of this check is: Passed
=======================================================================
Checking for Oracle Home incompatibilities ....
Actual Result: NEW_HOME
Check complete. The overall result of this check is: Passed
=======================================================================
如果进行了上述设置之后,那么自检的时候就会全部Passed。可以通过/sbin/sysctl -p来查
看/etc/sysctl.conf的配置情况。
2.7 为 oracle 用户设置 Shell 限制(root)
Oracle 建议对每个 Linux 帐户可以使用的进程数和打开的文件数设置限制。要进行如下这些更改。
同样使用gedit来完成。
在/etc/security/limits.conf中增加如下配置:
# For Oracle Install
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
在/etc/pam.d/login中增加如下配置:
# For Oracle Install
session required /lib/security/pam_limits.so
在/etc/profile中增加如下配置:
# For Oracle Install
if [ \$USER = "oracle" ]; then
if [ \$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
在/etc/csh.login中增加如下配置:
# For Oracle Install
if ( \$USER == "oracle" ) then
limit maxproc 16384
limit descriptors 65536
umask 022
endif
2.8 配置 oracle 用户的环境变量(oracle)
上面的操作都是在root用户下,这个配置需要以oracle用户登录系统进行配置。
[oracle@RHEL ~]$ gedit .bash_profile
具体配置如下:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
# For Oracle Install
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/usr/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
2.9 配置 oracle 用户的环境变量(root)
有的提到需要修改/etc/hosts文件,将127.0.0.1修改成为你的实际IP地址,否则有可能导致安装
Oracle的时候,检查网络配置异常。我也按照这个做了,但之后可能有麻烦,稍后再说。我是将其注释掉
,具体修改如下:
# Do not remove the following line, or various programs
# that require network functionality will fail.
# ::1 localhost.localdomain localhost RHEL
# 127.0.0.1 RHEL.smnpc.com localhost RHEL
10.10.10.197 RHEL.smnpc.com RHEL
2.10 Oracle支持的RHEL版本(root)
在2.6中Oracle安装自检时,列出了Oracle10g支持的版本是:must be redhat-3, SuSE-9, redhat-
4, UnitedLinux-1.0, asianux-1 or asianux-2。而我的系统是5.2。这里需要欺骗一下,具体的是修改
文件/etc/redhat-release。
[root@RHEL ~]# more /etc/redhat-release
Red Hat Enterprise Linux Server release 5.2 (Tikanga)
将5.2修改成4即可。网上也有说$ ./runInstaller -ignoreSysPrereqs方式来避免自检,但我没有实
验过。也有的通过如下方式:
[root@RHEL ~]# gedit /usr/app/oracle/install/install/oraparam.ini
###[Certified Versions]
Linux=redhat-3,SuSE-9,redhat-4,redhat-5,UnitedLinux-1.0,asianux-1,asianux-2]
再添加
[Linux-redhat-5.0-optional]TEMP_SPACE=80
SWAP_SPACE=150
MIN_DISPLAY_COLORS=256
但是,更多还是推荐第一种方式。至此,已经完成oracle 10g安装前的准备了。
将oracle的文件拷贝到 install下面,runinstall,在检测网络环境不过的时候 vi /etc/hosts
将ip改为本地的ip,不是127.0.0.1。完成后执行之后一个页面上的两个shell,直接拷贝命令到终端即可。
done!
这个很好:(就是没说包从dvd碟里就可找到,复制过来以免连接失效)
http://blog.csdn.net/lzysystem/article/details/3960853
1、由于orcale10不支持 redhat as5 需要修改/etc/redhat-realease 将 Red
Hat Enterprise Linux Server release 5 (Tikanga) 改为Red Hat Enterprise
Linux Server release 4 (Tikanga) ,安装完成后再将其修改回来
2、修改/etc/hosts 文件将127.0.0.1改为本机IP地址 否则网络检查通不过
3、检查安装所需的软件包,如果提示依赖性错误,先按照提示内容安装所需软件包后继续
setarch-2*
make-3*
glibc-2*
libaio-0*
compat-libstdc++-33-3*
compat-gcc-34-3*
compat-gcc-34-c++-3*
gcc-4*
libXp-1*
openmotif-2*
compat-db-4*
4、修改 /etc/sysctl.conf 内核配置文件,增加/修改以下项目,如没有自己添加
kernel.shmall = 2097152 # 可以使用的共享内存的总量。
kernel.shmmax = 2147483648 # 最大共享内存段大小。
kernel.shmmni = 4096 # 整个系统共享内存段的最大数目。
kernel.sem = 250 32000 100 128 # 每个信号对象集的最大信号对象数;系统范围内最大信号对象数;每个信号对象支持的最大操作数;系统范围内最大信号对象集数。
fs.file-max = 65536 # 系统中所允许的文件句柄最大数目。
net.ipv4.ip_local_port_range = 1024 65000 # 应用程序可使用的IPv4端口范围。
net.core.rmem_default = 1048576 # 套接字接收缓冲区大小的缺省值
net.core.rmem_max = 1048576 # 套接字接收缓冲区大小的最大值
net.core.wmem_default = 262144 # 套接字发送缓冲区大小的缺省值
net.core.wmem_max = 262144 # 套接字发送缓冲区大小的最大值
运行下面的命令使得内核参数生效:
/sbin/sysctl –p
注:内核参数并非必须修改,可以根据自己实际情况而定。
5、增加下面的内容到文件 /etc/security/limits.conf 文件中:
soft nproc 2047
hard nproc 16384
soft nofile 1024
hard nofile 65536
6、增加下面的内容到文件 /etc/pam.d/login 中:
session required /lib/security/pam_limits.so
session required pam_limits.so
7、因为SELINUX对oracle有影响,所以把secure linux设成无效,编辑文件 /etc/selinux/config :
SELINUX=disabled
当然你也可以用图形界面下的工具 (系统 > 管理 > 安全级别和防火墙). 选择SELinux页面并且设为无效.
8、新增组和用户:
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba oracle
passwd oracle
9、创建Oracle的安装目录,并把权限付给oracle用户:
mkdir -p /u01/app/oracle/product/10.2.0/db_1
chown -R oracle.oinstall /u01
10、配置环境变量(/etc/profile),增加一下内容
# Oracle Settings
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
PATH=$PATH:$ORACLE_HOME/bin ; export PATH
修改后使用source .bash_profile 命令使配置生效
11、设置安装语言设置
登陆oracle用户
因为中文安装会有乱码所以设置用英文安装 export LC_ALL=en_US
12、开始安装
进入oracle安装目录中,执行./runInstaller
如果提示……/.oui权限不够,进入install目录,执行
chmod u+x .oui
chmod u+x unzip
后再执行./runInstaller便会出现安装界面
在安装过程中选择高级安装,并将数据库语言选中文字符集选GBK,如果没有就选择UTF-8
安装快完成好的时候,会出现提示,必须以root 的身份执行两个脚本
13、增加启动
在/etc/rc.d/rc.local中加入如下:
su - oracle -c lsnrctl start
su - oracle -c dbstart
14、Oracle的卸载
$./runInstaller -silent -deinstall -removeallfiles -removeAllPatches "REMOVE_HOMES={$ORACLE_HOME}" -responseFile