系统版本:centos4.8
IP :192.168.3.3
数据库版本:oracle9204
一、安装准备:
http://mirrors.kernel.org/centos/ 下载centos4.8
由于oracle官方不在提供oracle9i的下载,可以从其他渠道获得,google吧。
1、安装oracle9需要的一些兼容性库包
[root@cent4 92huanjing]#]# ls
alsa-lib-devel-1.0.6-5.RHEL4.i386.rpm
audiofile-devel-0.2.6-1.el4.1.i386.rpm
esound-devel-0.2.35-2.i386.rpm
fontconfig-devel-2.2.3-13.el4.i386.rpm
freetype-devel-2.1.9-8.el4.6.i386.rpm
glib-devel-1.2.10-15.i386.rpm
gnome-libs-devel-1.4.1.2.90-44.1.i386.rpm
gtk+-devel-1.2.10-36.i386.rpm
imlib-devel-1.9.13-23.i386.rpm
libaio-0.3.105-2.i386.rpm
libao-devel-0.8.5-2.EL.0.i386.rpm
libjpeg-devel-6b-33.i386.rpm
libtiff-devel-3.6.1-12.el4_7.2.i386.rpm
libungif-devel-4.1.3-1.el4.2.i386.rpm
openmotif21-2.1.30-11.RHEL4.6.i386.rpm
ORBit-devel-0.5.17-14.i386.rpm
xorg-x11-6.8.2-1.EL.63.i386.rpm
xorg-x11-deprecated-libs-6.8.2-1.EL.63.i386.rpm
xorg-x11-deprecated-libs-devel-6.8.2-1.EL.63.i386.rpm
xorg-x11-devel-6.8.2-1.EL.63.i386.rpm
xorg-x11-libs-6.8.2-1.EL.63.i386.rpm
xorg-x11-xfs-6.8.2-1.EL.63.i386.rpm
这些包都在系统盘上面,拽放到服务器上一个目录下面;
[root@cent4 92huanjing]# rpm -ivh *.rpm
warning: alsa-lib-devel-1.0.6-5.RHEL4.i386.rpm: V3 DSA signature: NOKEY, key ID 443e1821
error: Failed dependencies:
libao = 0.8.5 is needed by libao-devel-0.8.5-2.EL.0.i386
Suggested resolutions:
/home/buildcentos/CENTOS/en/4.0/i386/CentOS/RPMS/libao-0.8.5-2.EL.0.i386.rpm
有依赖包的存在,根据提示安装所依赖的包如下:
加载光盘安装libao
[root@cent4 92huanjing]# rpm -ivh /mnt/cdrom/CentOS/RPMS/libao-0.8.5-2.EL.0.i386.rpm
warning: /mnt/cdrom/CentOS/RPMS/libao-0.8.5-2.EL.0.i386.rpm: V3 DSA signature: NOKEY, key ID 443e1821
Preparing... ########################################### [100%]
1:libao ########################################### [100%]
[root@cent4 92huanjing]#
[root@cent4 92huanjing]#rpm -ivh /mnt/cdrom/CentOS/RPMS/libao-devel-0.8.5-2.EL.0.i386.rpm
warning: /mnt/cdrom/CentOS/RPMS/libao-devel-0.8.5-2.EL.0.i386.rpm: V3 DSA signature: NOKEY, key ID 443e1821
Preparing... ########################################### [100%]
1:libao-devel ########################################### [100%]
[root@cos4 /]#
[root@cent4 92huanjing]# rpm -ivh *.rpm
warning: alsa-lib-devel-1.0.6-5.RHEL4.i386.rpm: V3 DSA signature: NOKEY, key ID 443e1821
Preparing... ########################################### [100%]
package xorg-x11-libs-6.8.2-1.EL.63 is already installed
package xorg-x11-deprecated-libs-6.8.2-1.EL.63 is already installed
package xorg-x11-xfs-6.8.2-1.EL.63 is already installed
package libao-devel-0.8.5-2.EL.0 is already installed
package xorg-x11-6.8.2-1.EL.63 is already installed
提示有的包已经安装了
[root@cent4 92huanjing]# mkdir installed
[root@cos4 oracle92huanjing]# mv xorg-x11-libs-6.8.2-1.EL.63.i386.rpm xorg-x11-deprecated-libs-6.8.2-1.EL.63.i386.rpm xorg-x11-xfs-6.8.2-1.EL.63.i386.rpm libao-devel-0.8.5-2.EL.0.i386.rpm xorg-x11-6.8.2-1.EL.63.i386.rpm installed/
[root@cent4 92huanjing]# rpm -ivh *.rpm
warning: alsa-lib-devel-1.0.6-5.RHEL4.i386.rpm: V3 DSA signature: NOKEY, key ID 443e1821
Preparing... ########################################### [100%]
1:glib-devel ########################################### [ 6%]
2:ORBit-devel ########################################### [ 12%]
3:libungif-devel ########################################### [ 18%]
4:libtiff-devel ########################################### [ 24%]
5:libjpeg-devel ########################################### [ 29%]
6:freetype-devel ########################################### [ 35%]
7:fontconfig-devel ########################################### [ 41%]
8:xorg-x11-devel ########################################### [ 47%]
9:gtk+-devel ########################################### [ 53%]
10:imlib-devel ########################################### [ 59%]
11:audiofile-devel ########################################### [ 65%]
12:alsa-lib-devel ########################################### [ 71%]
13:esound-devel ########################################### [ 76%]
14:gnome-libs-devel ########################################### [ 82%]
15:libaio ########################################### [ 88%]
16:openmotif21 ########################################### [ 94%]
17:xorg-x11-deprecated-lib########################################### [100%]
2、安装有关oracle兼容性的包,解决依赖关系;
[root@cent4 oracle-specific]# rpm -ivh compat-libcwait-2.1-1.i386.rpm
Preparing... ########################################### [100%]
cat: /etc/ld.so.preload: No such file or directory
1:compat-libcwait ########################################### [100%]
[root@cent4 oracle-specific]#rpm -ivh compat-oracle-rhel4-1.0-5.i386.rpm
error: Failed dependencies:
libaio-devel is needed by compat-oracle-rhel4-1.0-5.i386
Suggested resolutions:
/home/buildcentos/CENTOS/en/4.0/i386/CentOS/RPMS/libaio-devel-0.3.105-2.i386.rpm
[root@cent4 oracle-specific]# rpm -ivh /mnt/cdrom/CentOS/RPMS/libaio-devel-0.3.105-2.i386.rpm
warning: /mnt/cdrom/CentOS/RPMS/libaio-devel-0.3.105-2.i386.rpm: V3 DSA signature: NOKEY, key ID 443e1821
Preparing... ########################################### [100%]
1:libaio-devel ########################################### [100%]
[root@cent4 oracle-specific]# rpm -ivh compat-oracle-rhel4-1.0-5.i386.rpm
Preparing... ########################################### [100%]
1:compat-oracle-rhel4 ########################################### [100%]
3、解压oracle9安装包
[root@cent4 tarpackets]# gzip -d ship_9204_linux_disk1.cpio.gz
[root@cent4 tarpackets]# gzip -d ship_9204_linux_disk2.cpio.gz
[root@cent4 tarpackets]# gzip -d ship_9204_linux_disk3.cpio.gz
[root@cent4 tarpackets]#cpio -idmv < ship_9204_linux_disk1.cpio
[root@cent4 tarpackets]# cpio -idmv < ship_9204_linux_disk2.cpio
[root@cent4 tarpackets]#cpio -idmv < ship_9204_linux_disk3.cpio
[root@cent4 tarpackets]#rm -rf *.cpio
二、创建用户和组及安装目录
[root@cent4 /]#groupadd oinstall
[root@cent4 /]#groupadd dba
[root@cent4 /]#useradd -g oinstall -G dba oracle
[root@cent4 /]#passwd oracle
[root@cent4 /]#mkdir -p /opt/ora9/product/9.2
[root@cent4 /]#mkdir /var/opt/oracle
[root@cent4 /]#chown oracle.dba /var/opt/oracle
[root@cent4 /]#chown -R oracle.dba /opt/ora9
[root@cent4 opt]# ll
total 4
drwxr-xr-x 10 oracle dba 4096 Sep 26 13:49 ora9
三、设置安装oracle的环境变量
1、设置内核参数
在/etc//sysctl.conf 后面添加如下:
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
[root@cent4 /]# sysctl -p 生效
2、/etc/security/limits.conf 后面添加如下
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
重启生效
3、切换到oracle用户下修改.bash_profile文件
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=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
四、安装
使用oracle用户登陆到图形界面下面
[oracle@cent4 ~]$ env |grep ORA
ORACLE_OWNER=oracle
ORACLE_SID=ora9i
ORACLE_BASE=/opt/ora9
ORACLE_TERM=vt100
ORACLE_HOME=/opt/ora9/product/9.2
[oracle@cent4 tarpackets]$ cd Disk1
[oracle@cent4 Disk1]$ ls
doc index.htm install lgto response runInstaller stage
[oracle@cent4 Disk1]$ ./runInstaller
基本上和oracle10g的安装差不多,截图如下:
输入定义的组oinstall,根据提示用root账户运行/tmp/orainstroot.sh
[root@cent4 tmp]# pwd
/tmp
[root@cent4 tmp]# ./orainstRoot.sh
Creating Oracle Inventory pointer file (/etc/oraInst.loc)
Changing groupname of /opt/ora9/oraInventory to oinstall.
选择语言
点ok ,next
安装过程根据提示在次以root身份运行脚本
[root@cent4 9.2]# ./root.sh
Running Oracle9 root.sh script...
\nThe following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /opt/ora9/product/9.2
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
\nCreating /etc/oratab file...
Adding entry to /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
点ok 继续
安装完成, 点exit推出安装;
在图形界面下Oracle用户运行netca创建监听,基本上默认即可
#ps -ef |grep oracle
我们只是安装了oracle,并没有创建数据库;接下来创建数据库库
图形界面下以oracle用户使用dbca命令,节选了几个图像:
字体选择第二种,以便使用中文;
在安装的过程中会遇到两个错误的提示,根据网上资料得知这两个错误是公开的bug,在安装时可以点击忽略继续安装,安装完成后,在$ORACLE_HOME/rdbms/admin 目录下运 行utlrp.sql ,用于修补ORA-29807 错误
输入sys和system的密码就可以了
创建数据库完毕,计入系统查看进程 ,示例已经运行起来:
五,验证oracle与修补29807错误
[oracle@cent4 ~]$ sqlplus /nolog
SQL*Plus: Release 9.2.0.4.0 - Production on Sun Sep 26 14:53:59 2010
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> conn /as sysdba
Connected.
SQL> show databases;
SP2-0158: unknown SHOW option "databases"
SQL> create table t(id int,name char(10));
Table created.
SQL> insert into t values(0,'summer');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t;
ID NAME
---------- ----------
0 summer
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql
PL/SQL procedure successfully completed.
Table created.
Table created.
Table created.
Index created.
Table created.
Table created.
View created.
View created.
Package created.
No errors.
Package body created.
No errors.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
SQL>
参考:http://www.oracle.com/technology/global/cn/sample_code/tutorials/idclinux/Oracle9iR2onredhat9.html