Install Oracle9 on RedHat


A useful guide for installation oracle on redhat.

1.Download Software
Download Sun's Java Development Kit (JDK 1.3.1).
Download the Oracle installation files from otn.oracle.com.
Download the Oracle 9.2.0.4.0 patchset files from metalink.oracle.com.
Download the following patches (3006854, 3119415) from metalink.oracle.com.

从网上下载升级补丁包,用于将Oracle9.2.0升级到9.2.0.4: p3006854_9204_LINUX.zip
所有的补丁说明如下:
p3006854_9204_LINUX.zip 在运行 runInstaller 之前打.
/***如果直接安装9204,不需打如下补丁包
p3095277_9204_LINUX.zip 9.2.0.4.0的升级补丁包.
p2617419_210_GENERIC.zip 打3119415补丁所需要的补丁.
p3119415_9204_LINUX.zip 在升级到9.2.0.4.0之后打.
***/

1).用rpm -qa│grep compat 查看系统中是否安有以下几个软件包: (su -root)
compat-libstdc++-7.3-2.96.122
compat-gcc-c++-7.3-2.96.122
compat-libstdc++-devel-7.3-2.96.122
compat-db-4.0.14-5
compat-gcc-7.3-2.96.122
tcl-devel-8.3.5-92.i386.ipm
其他相关软件包(安装上述软件包时可能需要):
glibc-kemheadsers-2.4-8.34.i386.rpm
glib-headers-2.3.2-95.20.i386.rpm
glib-derel-2.3.2-95.20.i386.rpm
2). rpm -qa │ grep openmotif查看下列软件包
openmotif21-2.1.30-8
3). rpm -qa │ grep setarch查看:
setarch-1.3-1
4)Put gcc296 and g++296 first in $PATH variable by creating the following symbolic links:
mv /usr/bin/gcc /usr/bin/gcc323
mv /usr/bin/g++ /usr/bin/g++323
ln -s /usr/bin/gcc296 /usr/bin/gcc
ln -s /usr/bin/g++296 /usr/bin/g++

**如果没有安装,请使用如下命令安装
---加载文件命令:#rpm –ivh /mnt/cdrom/RedHat/RPMB/[filename].rpm

From RedHat AS3 Disk 2

su -root
cd /mnt/cdrom/RedHat/RPMS
rpm -Uvh setarch-1.3-1.i386.rpm
rpm -Uvh tcl-8.3.5-92.i386.rpm

From RedHat AS3 Disk 3

cd /mnt/cdrom/RedHat/RPMS
rpm -Uvh openmotif21-2.1.30-8.i386.rpm
rpm -Uvh compat-db-4.0.14-5.i386.rpm \
compat-gcc-7.3-2.96.122.i386.rpm \
compat-gcc-c++-7.3-2.96.122.i386.rpm \
compat-libstdc++-7.3-2.96.122.i386.rpm \
compat-libstdc++-devel-7.3-2.96.122.i386.rpm

2.Set Kernel Parameters
设置内核参数,调节信号灯及共享内存:

修改 /etc/sysctl.conf 这个文件,加入以下的语句:
kernel.shmmax = 2147483648 (机器内存2G,如果你的没这么大可相应设置小些)
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000

sem 4个参数依次为SEMMSL(每个用户拥有信号量最大数);SEMMNS(系统信号量最大数);SEMOPM(每次semopm系统调用操作数);SEMMNI(系统辛苦量集数最大数).
Shmmax 最大共享内存2GB 物理内存如果小的话可以设置成 536870912.
Shmmni 最小共享内存 4096KB.
Shmall 所有内存大小.

设置完成后用命令 more /etc/sysctl.conf |grep kernel.s 检查.

3、设置oracle对文件的要求:
编辑文件:/etc/security/limits.conf 加入以下语句:
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384

4.Setup
1).Create the new groups and users:
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle
2).Create the directories in which the Oracle software will be installed:

mkdir -p /opt/ora9/product/9.2

mkdir /var/opt/oracle

chown oracle.dba /var/opt/oracle

chown -R oracle.dba /opt/ora9

3)Login as the oracle user and add the following lines at the end of the .bash_profile file:
设置oracle用户的环境, 新开一个终端,***注意一定要新开一个 ***
su - oracle
打开.bash_profile文件,将如下内容加入:
(命令vi $HOME/.bash_profile 编辑用VI使用可查手册 I 进入edit ;w 存盘 ;q退出)
#oracle 9i
export DISPLAY=”192.9.200.24:0.0” (127.0.0.1:0.0)
export ORACLE_BASE=/opt/ora9
export ORACLE_HOME=/opt/ora9/product/9.2
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
export ORACLE_OWNER=oracle
export ORACLE_SID=ora9i (数据库全局变量名)
export ORACLE_TERM=xterm (xterm窗口模式 vt100 终端调试模式)
export LD_ASSUME_KERNEL=2.4.1
export THREADS_FLAG=native
export LD_LIBRARY_PATH=/opt/ora9/product/9.2/lib:$LD_LIBRARY_PATH
export PATH=/opt/ora9/product/9.2/bin:$PATH
export NLS_LANG=AMERICAN (设置语言AMERICAN英文)
export LANG=us_en
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
保存后退出. 执行: source .bash_profile 查看 set | more
然后。退出登录,再次进入,这时候oracle的环境就已经生效了.

Make sure the hostname command returns a fully qualified host name by amending the /etc/hosts file if necessary: hostname

5)Install the 3006854 patch:

unzip p3006854_9204_LINUX.zip
cd 3006854
sh rhel3_pre_install.sh

5.Unpack Files

1)First unzip the files:
gunzip lnx_920_disk1.cpio.gz
gunzip lnx_920_disk2.cpio.gz
gunzip lnx_920_disk3.cpio.gz

2)Next unpack the contents of the files:
cpio -idmv < lnx_920_disk1.cpio
cpio -idmv < lnx_920_disk2.cpio
cpio -idmv < lnx_920_disk3.cpio
mkdir 92040
unzip -d 92040 p3095277_9204_LINUX.zip
cd 92040
cpio -idmv < 9204_lnx32_release.cpio

You should now have three directories (Disk1, Disk2 and Disk3) containing installation files and a 92040/Disk1 directory containing the patch installation files.

6.Installation
新开一个控制终端(用root用户开)
#xhost 192.168.0.2 (本地IP地址)
(xhost disable访问控制,客户端可以从任何主机进行连接)
这个命令用来保证oracle用户调用X11,否则无法安装
#su - oracle
在登录终端中切换到oracle用户:
在oracle主目录里运行:# /home/ora9i/Disk1/runInstaller

7.Post-installation
1)Change the line in /etc/oratab from:
$:/opt/oracle/product/9.2.0:N
to read:
$:/opt/oracle/product/9.2.0:Y
2)
cd $ORACLE_HOME/dbs
ln -s init.ora init$.ora


安装过程中的注意事项:
1.在安装中让你输入 UNIX group name:oinstall (#groupadd oinstall)
如果提示orainstRoot.sh权限问题,在root终端下执行:
#sh /tmp/orainstRoot.sh 然后继续
2. 安装过程中提示/opt/ora9/product/9.2 权限问题,可另开窗口修改权限为oracle-dba
在结束的时候还会提示权限问题,另开窗口修改权限为root-root
注意的是以下几点:
Relink阶段,会出两个错误:ins_oemagent.mk 和 ins_ctx.mk. 点 Ignore 忽略.
在部分文档里,要求oracle用户的bash_profile文件中降LD_ASSUME_KERNEL设置为2.4.19,千万不要这样设置,否则会在Rlink时会有一大堆报错
再安装过程中,系统会提醒你用root身份去执行两个sh文件,再root的登录终端中按提示操作就可以了
如果有NLS的错误提示,可以#unset LANG命令,把语言默认成英文.
5.开始升级oracle su - oracle
安装结束后,HTTPD会自动运行.在升级之前,需要将它停下来.
$ cd $ORACLE_HOME/Apache/Apache/bin
$ apachectl stop
./apachectl stop: httpd stopped
LISTENER也需要停下来.
$ lsnrctl stop
LSNRCTL for Linux: Version 9.2.0.1.0 - Production on 07-NOV-2003 16:25:41
Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(PORT=1521))
The command completed successfully
注意: 如果不停的话,oracle会提示不能覆盖文件.这个时候再去将服务停下来也可以,点Retry就可以了.

开始打补丁升级.
注意打补丁时使用root用户,切换到root用户控制台:
解包:

unzip /home/ora9i/p3095277_9204_LINUX.zip

Archive: p3095277_9204_LINUX.zip
inflating: 9204_lnx32_release.cpio
inflating: README.html
inflating: patchnote.css
(会在/home/ora9/Disk1下自动生成9204_lnx32_release.cpio)

cpio –idmv < /home/ora9/Disk1/9204_lnx32_release.cpio

做完这个后,再切换到oracle用户控制台, 再次运行/home/ora9i/Disk1/runInstaller升级,注意必须先选择最下面的安装选项,安装OUI
要不然没有办法打那个最上面的升级补丁。
升级完OUI后,要退出,再次运行/home/ora9i/Disk1/runInstaller
选择第一个选项,将Oracle升级到9.2.0.4。
这时候还是会有一个错误出现。再次选择忽略它。
安装过程中如果出现/opt/ora9/product/9.2 没有权限,直接找到文件夹更改权限.

6.打其他的补丁:
切换到root的终端。
首先安装 opatch.

unzip p2617419_210_GENERIC.zip

Archive: p2617419_210_GENERIC.zip
creating: OPatch/
creating: OPatch/docs/
inflating: Opatch/docs/FAQ
......
inflating: README.txt
#pwd (查看执行权限)
#export PATH=$PATH:/home/ora9i/Opatch:/sbin
(修改PATH时要要包括解压缩出来的Opatch 和 sbin目录)

unzip p3119415_9204_LINUX.zip

Archive: p3119415_9204_LINUX.zip
creating: 3119415/
inflating: 3119415/README.txt

cd 3119415

opatch apply

如果提示HOME变量错误可执行语句:
#export ORACLE_BASE=/opt/ora9
#export ORACLE_HOME=/opt/ora9/product/9.2
出现success的提示就全部安装成功.
(出现选择ORACLE_HOME=/opt/ora9/product/9.2选择N)

最后切换到oracle终端
#dbca (如果有乱码执行:#unset LANG)
建oracle数据库
(查看安装完成后的检查和测试内容)


可能会出现错误提示: /etc/oratab file doesn’t exist
可执行下面语句:
#cd /opt/ora9/product/9.2/install/utl
#sh root.sh


数据库建立完成后挂起oracle
启动oracle监听
$lsnrctl
lsnrctl>status (查状态)
lsnrctl>start

检查oracle服务是否挂起
$ps –ef |grep ora

连接数据库
$sqlplus /nolog
SQL>connect / as sysdba
SQL>startup mount
检查是否连接oracle
SQL>select sysdate from dual;
Sp2-0640:Not connected
挂起
SQL>startup


如果出现错误信息:
ORA-01078:failucr in processing system parameters
LRM-00109:could not open parametet file/opt/ora9/product/9.2/dbs/initora9i.or
执行:
#cp /opt/ora9/admin/orcl/pfile/init.ora.613200412101 /opt/ora9/product/9.2/dbs/initora9.ora

Published At
Categories with 数据库类
Tagged with
comments powered by Disqus